diff --git a/agrep.c b/agrep.c index 765eeb5..92efcd4 100644 --- a/agrep.c +++ b/agrep.c @@ -222,6 +222,7 @@ CHAR *agrep_saved_pattern = NULL; /* to prevent multiple prepfs for each boolean #ifdef _WIN32 #include #include +#endif int agrep_usage(); /* agrep.c */ int exec(); /* agrep.c */ int exponen(); /* agrep.c */ @@ -244,7 +245,6 @@ int sgrep(); /* sgrep.c */ int initialize_common(); /* dummyfil.c */ int tuncompressible_filename(); /* dummyfil.c */ int quick_tcompress(); /* dummyfil.c */ -#endif /* Called when multipattern search and pattern has not changed */ diff --git a/agrephlp.c b/agrephlp.c index d3df89c..98185ca 100644 --- a/agrephlp.c +++ b/agrephlp.c @@ -10,8 +10,8 @@ #ifdef _WIN32 #include "conio.h" -int get_current_codepage(); /* codepage.c */ #endif +int get_current_codepage(); /* codepage.c */ #define CUL 0x4B00 #define CUP 0x4800 @@ -65,8 +65,8 @@ int get_current_codepage(); /* codepage.c */ #include "agrep.h" #include "version.h" -extern AGREPOPT_STR[MAX_LINE_LEN]; -extern VERBOSE; +extern char AGREPOPT_STR[MAX_LINE_LEN]; +extern int VERBOSE; #ifdef __EMX__ extern unsigned int _emx_env; diff --git a/asearch.c b/asearch.c index 5a57e11..574f301 100644 --- a/asearch.c +++ b/asearch.c @@ -23,11 +23,9 @@ extern int NEW_FILE, POST_FILTER; extern int LIMITOUTPUT, LIMITPERFILE; -#ifdef _WIN32 int output(); /* agrep.c */ int asearch0(); /* asearch.c */ int fill_buf(); /* bitap.c */ -#endif int asearch(old_D_pat, text, D) diff --git a/asearch1.c b/asearch1.c index c577d70..50af21e 100644 --- a/asearch1.c +++ b/asearch1.c @@ -20,10 +20,8 @@ extern int NEW_FILE, POST_FILTER; extern int LIMITOUTPUT, LIMITPERFILE; -#ifdef _WIN32 int output(); /* agrep.c */ int fill_buf(); /* bitap.c */ -#endif int asearch1(old_D_pat, Text, D) diff --git a/bitap.c b/bitap.c index 2afa1d5..4942f37 100644 --- a/bitap.c +++ b/bitap.c @@ -65,13 +65,13 @@ extern int NEW_FILE, POST_FILTER; #ifdef _WIN32 #include +#endif int output(); /* agrep.c */ int re(); /* agrep.c */ int re1(); /* agrep.c */ int asearch(); /* asearch.c */ int asearch1(); /* asearch1.c */ int fill_buf(); /* bitap.c */ -#endif /* bitap dispatches job */ @@ -447,6 +447,7 @@ int fd, M, D; #endif /*AGREP_POINTER*/ } +int fill_buf(fd, buf, record_size) int fd, record_size; unsigned char *buf; diff --git a/codepage.c b/codepage.c index b448b7b..7b0d4a5 100644 --- a/codepage.c +++ b/codepage.c @@ -47,7 +47,7 @@ char CP_MAPPING; /* -i option = case(in)sensitive search ? unsigned char LUT[256]; /* THE LOOK-UP TABLE (filled in AGREP.C) */ -int get_current_codepage(VOID) +int get_current_codepage(void) #ifdef __EMX__ diff --git a/compat.c b/compat.c index 7635bf7..e50fbeb 100644 --- a/compat.c +++ b/compat.c @@ -8,13 +8,13 @@ extern int D; extern int FILENAMEONLY, APPROX, PAT_FILE, PAT_BUFFER, MULTI_OUTPUT, COUNT, INVERSE, BESTMATCH; -extern FILEOUT; -extern REGEX; -extern DELIMITER; -extern WHOLELINE; -extern LINENUM; -extern I, S, DD; -extern JUMP; +extern int FILEOUT; +extern int REGEX; +extern int DELIMITER; +extern int WHOLELINE; +extern int LINENUM; +extern int I, S, DD; +extern int JUMP; extern char Progname[32]; extern int agrep_initialfd; extern int EXITONERROR; diff --git a/main.c b/main.c index 81ec0f2..1acd1e2 100644 --- a/main.c +++ b/main.c @@ -20,9 +20,7 @@ extern int EXITONERROR; extern unsigned int _emx_env; /* this variable denotes the operating system DOS, OS/2 */ #endif -#ifdef _WIN32 int fileagrep(); /* agrep.c */ -#endif #ifndef _WIN32 int diff --git a/maskgen.c b/maskgen.c index e8e28e9..1348671 100644 --- a/maskgen.c +++ b/maskgen.c @@ -16,7 +16,7 @@ extern int CODEPAGE; extern struct CODEPAGE_struct CP[CODEPAGES][CPSIZE]; extern unsigned D_endpos, endposition, Init1, wildmask; -extern Mask[], Bit[], Init[], NO_ERR_MASK; +extern unsigned Mask[], Bit[], Init[], NO_ERR_MASK; extern int AND, REGEX, NOUPPER, D_length; extern unsigned char Progname[]; extern int agrep_initialfd; diff --git a/newmgrep.c b/newmgrep.c index bff5748..20d343c 100644 --- a/newmgrep.c +++ b/newmgrep.c @@ -70,14 +70,14 @@ extern CHAR D_pattern[MaxDelimit*2]; extern int D_length; extern CHAR tc_D_pattern[MaxDelimit*2]; extern int tc_D_length; -extern COUNT, FNAME, SILENT, FILENAMEONLY, prev_num_of_matched, num_of_matched; -extern INVERSE, OUTTAIL; -extern WORDBOUND, WHOLELINE, NOUPPER; +extern int COUNT, FNAME, SILENT, FILENAMEONLY, prev_num_of_matched, num_of_matched; +extern int INVERSE, OUTTAIL; +extern int WORDBOUND, WHOLELINE, NOUPPER; extern ParseTree *AParse; extern int AComplexPattern; extern unsigned char CurrentFileName[], Progname[]; -extern total_line; -extern agrep_initialfd; +extern int total_line; +extern int agrep_initialfd; extern int EXITONERROR; extern int PRINTPATTERN; extern int agrep_inlen; @@ -119,12 +119,10 @@ extern int anum_terminals; extern int AComplexBoolean; static void countline(unsigned char *text, int len); -#ifdef _WIN32 int eval_tree(); /* asplit.c */ int fill_buf(); /* bitap.c */ int monkey1(); /* newmgrep.c */ int m_short(); /* newmgrep.c */ -#endif #if DOTCOMPRESSED /* Equivalent variables for compression search */ diff --git a/parse.c b/parse.c index ecb1bc2..3d20b41 100644 --- a/parse.c +++ b/parse.c @@ -6,10 +6,10 @@ #ifdef _WIN32 #include -#include #endif #include +#include #include "re.h" #define FALSE 0 diff --git a/preproce.c b/preproce.c index 904b285..794ce4a 100644 --- a/preproce.c +++ b/preproce.c @@ -42,13 +42,11 @@ extern ParseTree aterminals[MAXNUM_PAT]; extern char FREQ_FILE[MAX_LINE_LEN], HASH_FILE[MAX_LINE_LEN], STRING_FILE[MAX_LINE_LEN]; /* interfacing with tcompress */ extern int AComplexBoolean; -#ifdef _WIN32 int asplit_pattern(); /* asplit.c */ int asplit_terminal(); /* asplit.c */ int init(); /* follow.c */ void destroy_tree(); /* putils.c */ int quick_tcompress(); /* preproce.c */ -#endif int preprocess(D_pattern, Pattern) /* need two parameters */ diff --git a/putils.c b/putils.c index adc8ea2..1677ac0 100644 --- a/putils.c +++ b/putils.c @@ -68,6 +68,7 @@ get_token_bool(buffer, len, ptr, tokenbuf, tokenlen) void print_tree(t, level) ParseTree *t; + int level; { int i; diff --git a/re.h b/re.h index 8d18f34..ba3df38 100644 --- a/re.h +++ b/re.h @@ -4,6 +4,9 @@ allows the fully ISO-Charset. */ +#include +#include + /************************************************************* * * * Macros defining special characters. * @@ -72,8 +75,6 @@ #define new_node(type, l, x) \ {\ - extern void *malloc();\ -\ (l) = (type) malloc(sizeof(*(x)));\ if ((l) == NULL) {\ fprintf(stderr, "malloc failure in new_node\n");\ diff --git a/recursiv.c b/recursiv.c index 0d1d520..df4fc0d 100644 --- a/recursiv.c +++ b/recursiv.c @@ -21,6 +21,8 @@ #include "autoconf.h" /* ../libtemplate/include */ #include +#include +#include #include #if ISO_CHAR_SET @@ -59,12 +61,10 @@ #ifdef _WIN32 #include "config.h" -#include #include -#include #include -int exec(); /* agrep.c */ #endif +int exec(); /* agrep.c */ /* * #include diff --git a/sgrep.c b/sgrep.c index 9dce86c..374aa3a 100644 --- a/sgrep.c +++ b/sgrep.c @@ -97,7 +97,7 @@ extern int CONSTANT, COUNT, FNAME, SILENT, FILENAMEONLY, prev_num_of_matched, nu extern int DNA ; /* DNA flag is set in checksg when pattern is DNA pattern and p_size > 16 */ -extern WORDBOUND, WHOLELINE, NOUPPER; +extern int WORDBOUND, WHOLELINE, NOUPPER; extern unsigned char CurrentFileName[], Progname[]; extern unsigned Mask[]; extern unsigned endposition; @@ -123,7 +123,6 @@ extern void free_buf(int fd, char *sbuf); extern unsigned char * backward_delimiter(unsigned char *end, unsigned char *begin, unsigned char *delim, int len, int outtail); extern unsigned char * forward_delimiter(unsigned char *begin, unsigned char *end, unsigned char *delim, int len, int outtail); -#ifdef _WIN32 int fill_buf(); /* bitap.c */ int a_monkey(); /* sgrep.c */ int agrep(); /* sgrep.c */ @@ -133,7 +132,6 @@ int monkey(); /* sgrep.c */ int monkey4(); /* sgrep.c */ int s_output(); /* sgrep.c */ int verify(); /* sgrep.c */ -#endif #if MEASURE_TIMES /* timing variables */ @@ -262,7 +260,7 @@ int *m; int sgrep(in_pat, in_m, fd, D, samepattern) CHARTYPE *in_pat; -int fd, in_m, D; +int fd, in_m, D, samepattern; { CHARTYPE patbuf[MAXLINE]; CHARTYPE *pat = patbuf; @@ -1485,7 +1483,7 @@ CHARTYPE **lastout; /* in, out */ static void prep_bm(Pattern, m) unsigned char *Pattern; -register m; +register int m; { int i; unsigned hash; diff --git a/utilitie.c b/utilitie.c index 57021e3..a62088a 100644 --- a/utilitie.c +++ b/utilitie.c @@ -2,14 +2,15 @@ /* this file contains various utility functions for accessing and manipulating regular expression syntax trees. */ -#include #include +#include +#include +#include #include "re.h" #ifdef _WIN32 #include #include -#include #endif /************************************************************************/