agrep.c
void initial_value()
{
	SetCurrentFileName = 0;	/* 16/9/94 */
	SetCurrentByteOffset = 0;	/* 23/9/94 */

	/* courtesy: crd@hplb.hpl.hp.com */
	
	if (agrep_saved_pattern) {
		free(agrep_saved_pattern);
		agrep_saved_pattern= NULL;
	}
	
	/* bg: new stuff on 17/Feb/94 */
	
	if (multifd != -1) close(multifd);
	multifd = -1;
	if (multibuf != NULL) free(multibuf);
	multibuf = NULL;
	multilen = 0;
	if (pat_spool != NULL) free(pat_spool);
	pat_spool = NULL;

#if	DOTCOMPRESSED
	if (tc_pat_spool != NULL) free(tc_pat_spool);
	tc_pat_spool = NULL;
#endif	/* DOTCOMPRESSED */

	LIMITOUTPUT = 0;	/* means infinity = current semantics */
	LIMITPERFILE = 0;	/* means infinity = current semantics */
	LIMITTOTALFILE = 0;	/* means infinity = current semantics */
	EASYSEARCH = 1;
	DNA = APPROX = PAT_FILE = PAT_BUFFER = CONSTANT = total_line = D = TCOMPRESSED = 0;
	PAT_FILE_NAME[0] = '\0';
	EXITONERROR = NOFILENAME = FILENAMEONLY = FILEOUT = ALWAYSFILENAME = NEW_FILE = POST_FILTER = 0;

        original_old_D_pat[0] = old_D_pat[0] = '\n';
        original_old_D_pat[1] = old_D_pat[1] = '\0';
        original_D_pattern[0] = D_pattern[0] = '\n';
        original_D_pattern[1] = D_pattern[1] = ';';
        original_D_pattern[2] = D_pattern[2] = ' ';
        original_D_pattern[3] = D_pattern[3] = '\0';

	strcpy(tc_D_pattern, "\n");
	tc_D_length = 1;

	/* the functions agrep_init and agrep_search take care of Textfiles and Numfiles */
	agrep_inpointer = 0;
	agrep_outpointer = 0;
	agrep_outlen = 0;

#if	MEASURE_TIMES
	OUTFILTER_ms = FILTERALGO_ms = INFILTER_ms = 0;
#endif	/*MEASURE_TIMES*/

	MULTI_OUTPUT = 0;
	PRINTPATTERN = 0;
	PRINTFILENUMBER = 0;
	JUMP = FNAME = BESTMATCH = NOPROMPT = NOUPPER = ISO2ASCII = 0 ;
	RECURSIVE = 0;
	COUNT = LINENUM = WHOLELINE = SGREP = 0;
	NOOUTPUTZERO = 0;
	EATFIRST = INVERSE = TRUNCATE = OUTTAIL = 0; 
	NOMATCH = FIRSTOUTPUT = ON;	/* were off initally */
	I = DD = S = 1;	/* were off initially */
	original_D_length = D_length = 2;	/* was 0 initially */
	SILENT = Num_Pat = PSIZE = SIMPLEPATTERN = prev_num_of_matched = num_of_matched = files_matched = 0;
	WORDBOUND = DELIMITER = 0;

	COMP_DIR[0] = '\0';
	FREQ_FILE[0] = '\0';
	HASH_FILE[0] = '\0';
	STRING_FILE[0] = '\0';
	BYTECOUNT = OFF;
	PRINTOFFSET = OFF;
	PRINTRECORD = ON;

	glimpse_clientdied = 0;	/* added 15th Feb 95 */

	/* Pattern, OldPattern, execfd, Numfiles are set in agrep_init: so no need to initialize */
	reinit_value();
}
/* This must be called before every agrep_init to reset agrep options */
This must be called before every agrep_init to reset agrep options
This must be called before every agrep_init to reset agrep options
void initial_value()
{
	SetCurrentFileName = 0;	
	SetCurrentByteOffset = 0;	
	if (agrep_saved_pattern) {
		free(agrep_saved_pattern);
		agrep_saved_pattern= NULL;
	}
	if (multifd != -1) close(multifd);
	multifd = -1;
	if (multibuf != NULL) free(multibuf);
	multibuf = NULL;
	multilen = 0;
	if (pat_spool != NULL) free(pat_spool);
	pat_spool = NULL;
#if	DOTCOMPRESSED
	if (tc_pat_spool != NULL) free(tc_pat_spool);
	tc_pat_spool = NULL;
#endif	
	LIMITOUTPUT = 0;	
	LIMITPERFILE = 0;	
	LIMITTOTALFILE = 0;	
	EASYSEARCH = 1;
	DNA = APPROX = PAT_FILE = PAT_BUFFER = CONSTANT = total_line = D = TCOMPRESSED = 0;
	PAT_FILE_NAME[0] = '\0';
	EXITONERROR = NOFILENAME = FILENAMEONLY = FILEOUT = ALWAYSFILENAME = NEW_FILE = POST_FILTER = 0;
        original_old_D_pat[0] = old_D_pat[0] = '\n';
        original_old_D_pat[1] = old_D_pat[1] = '\0';
        original_D_pattern[0] = D_pattern[0] = '\n';
        original_D_pattern[1] = D_pattern[1] = ';';
        original_D_pattern[2] = D_pattern[2] = ' ';
        original_D_pattern[3] = D_pattern[3] = '\0';
	strcpy(tc_D_pattern, "\n");
	tc_D_length = 1;
	agrep_inpointer = 0;
	agrep_outpointer = 0;
	agrep_outlen = 0;
#if	MEASURE_TIMES
	OUTFILTER_ms = FILTERALGO_ms = INFILTER_ms = 0;
#endif	
	MULTI_OUTPUT = 0;
	PRINTPATTERN = 0;
	PRINTFILENUMBER = 0;
	JUMP = FNAME = BESTMATCH = NOPROMPT = NOUPPER = ISO2ASCII = 0 ;
	RECURSIVE = 0;
	COUNT = LINENUM = WHOLELINE = SGREP = 0;
	NOOUTPUTZERO = 0;
	EATFIRST = INVERSE = TRUNCATE = OUTTAIL = 0; 
	NOMATCH = FIRSTOUTPUT = ON;	
	I = DD = S = 1;	
	original_D_length = D_length = 2;	
	SILENT = Num_Pat = PSIZE = SIMPLEPATTERN = prev_num_of_matched = num_of_matched = files_matched = 0;
	WORDBOUND = DELIMITER = 0;
	COMP_DIR[0] = '\0';
	FREQ_FILE[0] = '\0';
	HASH_FILE[0] = '\0';
	STRING_FILE[0] = '\0';
	BYTECOUNT = OFF;
	PRINTOFFSET = OFF;
	PRINTRECORD = ON;
	glimpse_clientdied = 0;	
	reinit_value();
}
void initial_value ( ) { SetCurrentFileName = 0 ; SetCurrentByteOffset = 0 ; if ( agrep_saved_pattern ) { free ( agrep_saved_pattern ) ; agrep_saved_pattern = NULL ; } if ( multifd != -1 ) close ( multifd ) ; multifd = -1 ; if ( multibuf != NULL ) free ( multibuf ) ; multibuf = NULL ; multilen = 0 ; if ( pat_spool != NULL ) free ( pat_spool ) ; pat_spool = NULL ; #if DOTCOMPRESSED if ( tc_pat_spool != NULL ) free ( tc_pat_spool ) ; tc_pat_spool = NULL ; #endif LIMITOUTPUT = 0 ; LIMITPERFILE = 0 ; LIMITTOTALFILE = 0 ; EASYSEARCH = 1 ; DNA = APPROX = PAT_FILE = PAT_BUFFER = CONSTANT = total_line = D = TCOMPRESSED = 0 ; PAT_FILE_NAME [ 0 ] = ' \0 ' ; EXITONERROR = NOFILENAME = FILENAMEONLY = FILEOUT = ALWAYSFILENAME = NEW_FILE = POST_FILTER = 0 ; original_old_D_pat [ 0 ] = old_D_pat [ 0 ] = ' \n ' ; original_old_D_pat [ 1 ] = old_D_pat [ 1 ] = ' \0 ' ; original_D_pattern [ 0 ] = D_pattern [ 0 ] = ' \n ' ; original_D_pattern [ 1 ] = D_pattern [ 1 ] = ' ' ; original_D_pattern [ 2 ] = D_pattern [ 2 ] = ' ' ; original_D_pattern [ 3 ] = D_pattern [ 3 ] = ' \0 ' ; strcpy ( tc_D_pattern , " \n " ) ; tc_D_length = 1 ; agrep_inpointer = 0 ; agrep_outpointer = 0 ; agrep_outlen = 0 ; #if MEASURE_TIMES OUTFILTER_ms = FILTERALGO_ms = INFILTER_ms = 0 ; #endif MULTI_OUTPUT = 0 ; PRINTPATTERN = 0 ; PRINTFILENUMBER = 0 ; JUMP = FNAME = BESTMATCH = NOPROMPT = NOUPPER = ISO2ASCII = 0 ; RECURSIVE = 0 ; COUNT = LINENUM = WHOLELINE = SGREP = 0 ; NOOUTPUTZERO = 0 ; EATFIRST = INVERSE = TRUNCATE = OUTTAIL = 0 ; NOMATCH = FIRSTOUTPUT = ON ; I = DD = S = 1 ; original_D_length = D_length = 2 ; SILENT = Num_Pat = PSIZE = SIMPLEPATTERN = prev_num_of_matched = num_of_matched = files_matched = 0 ; WORDBOUND = DELIMITER = 0 ; COMP_DIR [ 0 ] = ' \0 ' ; FREQ_FILE [ 0 ] = ' \0 ' ; HASH_FILE [ 0 ] = ' \0 ' ; STRING_FILE [ 0 ] = ' \0 ' ; BYTECOUNT = OFF ; PRINTOFFSET = OFF ; PRINTRECORD = ON ; glimpse_clientdied = 0 ; reinit_value ( ) ; }
This must be called before every agrep_init to reset agrep options
This must be called before every agrep_init to reset agrep options
/* 16/9/94 */ /* 23/9/94 */ /* courtesy: crd@hplb.hpl.hp.com */ /* bg: new stuff on 17/Feb/94 */ /* DOTCOMPRESSED */ /* means infinity = current semantics */ /* means infinity = current semantics */ /* means infinity = current semantics */ /* the functions agrep_init and agrep_search take care of Textfiles and Numfiles */ /*MEASURE_TIMES*/ /* were off initally */ /* were off initially */ /* was 0 initially */ /* added 15th Feb 95 */ /* Pattern, OldPattern, execfd, Numfiles are set in agrep_init: so no need to initialize */