<commit_before>/* -MODULE----------------------------------------------------------------------
NEWPROJECT
Copyright (C) 2010, 2011 by Phorward Software Technologies, <NAME>
http://www.phorward-software.com ++ contact<AT>phorward<DASH>software<DOT>com

File:	main.c
Author:	<NAME>
Usage:	Program entry and parameter parsing.
----------------------------------------------------------------------------- */

/*
 * Includes
 */
#include <pbasis.h>
#include <pregex.h>
#include <pstring.h>

/*
 * Global variables
 */

/*
 * Defines
 */
#define VERSION		"0.2"

/*
 * Functions
 */
 
 /* -FUNCTION--------------------------------------------------------------------
	Function:		copyright()
	
	Author:			<NAME>
	
	Usage:			Prints a program copyright info message.
					
	Parameters:		void

	Returns:		void
  
	~~~ CHANGES & NOTES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Date:		Author:			Note:
----------------------------------------------------------------------------- */
void copyright( void )
{
	fprintf( stderr, "NEWPROJECT v%s [build %s %s]\n",
			VERSION, __DATE__, __TIME__ );
	fprintf( stderr, "Copyright (C) 2010 by "
						"Phorward Software Technologies, <NAME>\n" );
	fprintf( stderr, "http://www.phorward-software.com ++ "
						"contact<at>phorward<dash>software<dot>com\n\n" );
						
	fprintf( stderr, "THIS IS A TEMPLATE FOR NEW PROJECTS!\n\n" );
	
}

/* -FUNCTION--------------------------------------------------------------------
	Function:		usage()
	
	Author:			<NAME>
	
	Usage:			Prints the program usage message.
					
	Parameters:		uchar*		progname			Name of the executable.
	
	Returns:		void
  
	~~~ CHANGES & NOTES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Date:		Author:			Note:
----------------------------------------------------------------------------- */
void usage( uchar* progname )
{
	fprintf( stderr, "usage: %s [options]\n\n"
		"\t-h   --help            Print this help\n"
		"\t-V   --version         Print version and copyright\n",

		progname );
}

/* -FUNCTION--------------------------------------------------------------------
	Function:		get_command_line()
	
	Author:			<NAME>
	
	Usage:			Analyzes the command line parameters passed to this program.
					
	Parameters:		int			argc		Argument count from main()
					uchar**		argv		Argument values from main()
	
	Returns:		BOOLEAN					TRUE, if command-line parameters
											are correct, FALSE else.
  
	~~~ CHANGES & NOTES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Date:		Author:			Note:
----------------------------------------------------------------------------- */
BOOLEAN get_command_line( int argc, char** argv )
{
	int		i;
	uchar*	opt;

	for( i = 1; i < argc; i++ )
	{
		if( *(argv[i]) == '-' )
		{
			opt = argv[i] + 1;
			if( *opt == '-' )
				opt++;

			if( !strcmp( opt, "version" ) || !strcmp( opt, "V" ) )
			{
				copyright();
				exit( EXIT_SUCCESS );
			}
			else if( !strcmp( opt, "help" ) || !strcmp( opt, "h" ) )
			{
				usage( *argv );
				exit( EXIT_SUCCESS );
			}
		}
	}

	return TRUE;
}

/* -FUNCTION--------------------------------------------------------------------
	Function:		main()
	
	Author:			<NAME>
	
	Usage:			Program entry
					
	Parameters:		int		argc				Argument count
					char**	argv				Argument values<commit_msg>SCCS main.c 11/02/18 09:52:12: Replaced strcmp with pstrcmp<commit_after>/* -MODULE----------------------------------------------------------------------
NEWPROJECT
Copyright (C) 2010, 2011 by Phorward Software Technologies, <NAME>
http://www.phorward-software.com ++ contact<AT>phorward<DASH>software<DOT>com

File:	main.c
Author:	<NAME>
Usage:	Program entry and parameter parsing.
----------------------------------------------------------------------------- */

/*
 * Includes
 */
#include <pbasis.h>
#include <pregex.h>
#include <pstring.h>

/*
 * Global variables
 */

/*
 * Defines
 */
#define VERSION		"0.3"

/*
 * Functions
 */
 
 /* -FUNCTION--------------------------------------------------------------------
	Function:		copyright()
	
	Author:			<NAME>
	
	Usage:			Prints a program copyright info message.
					
	Parameters:		void

	Returns:		void
  
	~~~ CHANGES & NOTES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Date:		Author:			Note:
----------------------------------------------------------------------------- */
void copyright( void )
{
	fprintf( stderr, "NEWPROJECT v%s [build %s %s]\n",
			VERSION, __DATE__, __TIME__ );
	fprintf( stderr, "Copyright (C) 2010 by "
						"Phorward Software Technologies, <NAME>\n" );
	fprintf( stderr, "http://www.phorward-software.com ++ "
						"contact<at>phorward<dash>software<dot>com\n\n" );
						
	fprintf( stderr, "THIS IS A TEMPLATE FOR NEW PROJECTS!\n\n" );
	
}

/* -FUNCTION--------------------------------------------------------------------
	Function:		usage()
	
	Author:			<NAME>
	
	Usage:			Prints the program usage message.
					
	Parameters:		uchar*		progname			Name of the executable.
	
	Returns:		void
  
	~~~ CHANGES & NOTES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Date:		Author:			Note:
----------------------------------------------------------------------------- */
void usage( uchar* progname )
{
	fprintf( stderr, "usage: %s [options]\n\n"
		"\t-h   --help            Print this help\n"
		"\t-V   --version         Print version and copyright\n",

		progname );
}

/* -FUNCTION--------------------------------------------------------------------
	Function:		get_command_line()
	
	Author:			<NAME>
	
	Usage:			Analyzes the command line parameters passed to this program.
					
	Parameters:		int			argc		Argument count from main()
					uchar**		argv		Argument values from main()
	
	Returns:		BOOLEAN					TRUE, if command-line parameters
											are correct, FALSE else.
  
	~~~ CHANGES & NOTES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Date:		Author:			Note:
----------------------------------------------------------------------------- */
BOOLEAN get_command_line( int argc, char** argv )
{
	int		i;
	uchar*	opt;

	for( i = 1; i < argc; i++ )
	{
		if( *(argv[i]) == '-' )
		{
			opt = argv[i] + 1;
			if( *opt == '-' )
				opt++;

			if( !pstrcmp( opt, "version" ) || !pstrcmp( opt, "V" ) )
			{
				copyright();
				exit( EXIT_SUCCESS );
			}
			else if( !pstrcmp( opt, "help" ) || !pstrcmp( opt, "h" ) )
			{
				usage( *argv );
				exit( EXIT_SUCCESS );
			}
		}
	}

	return TRUE;
}

/* -FUNCTION--------------------------------------------------------------------
	Function:		main()
	
	Author:			<NAME>
	
	Usage:			Program entry
					
	Parameters:		int		argc				Argument count
					char**	argv				Argument values
{'fraction_non_alphanumeric': 0.3557228915662651, 'fraction_numerical': 0.006626506024096385, 'mean_word_length': 1.4733705772811918, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '197654', 'n_tokens_mistral': 2284, 'n_tokens_neox': 1944, 'n_words': 504}