download crc_test.cpp
Language: C++
LOC: 26
Project Info
grub.org - Distributed Internet Crawler(grub)
Server: SourceForge
Type: cvs
...ge\g\grub\grub\client\util\
   alt_ftw.c
   alt_ftw.h
   bin_test_util.dsp
   clog.cpp
   clog.h
   ConfigFileInfo.h
   crc.h
   crc_32.c
   crc_32.cpp
   crc_32.h
   crc_test.c
   crc_test.cpp
   crc32.c
   crc32.h
   dbl_list.c
   dbl_list.h
   delay.cpp
   delay.h
   diagnose.h
   fc32.c
   file_data.c
   file_data.h
   getopt.c
   getopt.h
   grubconf.c
   grubconf.h
   GrubExp.cpp
   GrubExp.h
   Gui.cpp
   Gui.h
   intl.h
   lib_util.dsp
   lockfile.cpp
   lockfile.h
   Makefile.am
   parsecfg.c
   parsecfg.h
   platform.h
   rmfiles.c
   rmfiles.h
   ServerSettings.cpp
   ServerSettings.h
   sniptype.h
   StatusInterface.cpp
   StatusInterface.h
   strip_url.c
   strip_url.h
   test_util.cpp

extern "C" {
#include "crc_32.h"
#include "file_data.h"
}
#include <stdio.h>
#include <string>

using namespace std;

int main( int argc, char *argv[] )
{
	unsigned long 	string_crc, crc;

	// test for arguments passed
	if ( argc < 2 ) 
	{
		printf("Need string to CRC!\n");
		return 1;
	}

	char the_string[100];	
	
	strncpy(the_string, argv[1], 100);
		
	cout << the_string << endl;

	// reset crc stuff
	gen_crc_table();

	crc_reset(&crc);

	// calculate crc for string
	// we have a global pointer crc that keeps the "total" crc value and then a
	// final url_crc value that gets passed back, which is the one that we use.
	for ( int i = 0; i < strlen( the_string ); i++ )
	{
		string_crc = get_crc( &crc, (int)the_string[i] );
	}
	printf("%u\n", string_crc);


}

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us