<commit_before>/*
COPY RETURN CODES
Return codes are incase of error displayed and handled by BTSOOT.

return -1 = incorrect number of args
return 0 = ok
return 1 = couldnt open source fd
return 2 = couldnt open dest fd
return 3 = couldnt write to dest fd
return 4 = couldnt read from source fd
return 5 = couldnt close source fd
return 6 = couldnt close dest fd
*/

#include<stdio.h>
#include<fcntl.h>
#include<sys/stat.h>
#include<unistd.h>

int copy(char *source, char *destination);

int main(int argc, char *argv[])
{
	int exit_code;

	if(argc != 3)
	{
		return -1;
	}

	exit_code = copy(argv[1], argv[2]);
	return exit_code;
}

int copy(char *source, char *destination)
{
	int fd_source;
	int fd_destination;
	char buffer[BUFSIZ];
	int dest_flags;
	mode_t permissions;
	ssize_t read_check;
	ssize_t temp_offset;

	/*compiler complains...*/
	read_check = 0;
	temp_offset = 0;
	
	fd_source = open(source, O_RDONLY);
	if(fd_source == -1)
	{
		return 1;
	}
	
	dest_flags = O_CREAT | O_WRONLY | O_TRUNC;
	
	permissions = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;

	fd_destination = open(destination, dest_flags, permissions);
	if(fd_destination == -1)
	{
		return 2;
	}
	
	while((tempoffset = sendfile(fd_destination, fd_source, read_check, BUFSIZ))
	{
		read_check += tempoffset;
	}
	if(read_check == -1)
	{
		return 4;
	}
	
	/*close fds*/
	if(close(fd_source) == -1)
	{
		return 5;
	}
	if(close(fd_destination) == -1)
	{
		return 6;
	}
	
	return 0;
}
<commit_msg>Remove paranthesis syntax error<commit_after>/*
COPY RETURN CODES
Return codes are incase of error displayed and handled by BTSOOT.

return -1 = incorrect number of args
return 0 = ok
return 1 = couldnt open source fd
return 2 = couldnt open dest fd
return 3 = couldnt write to dest fd
return 4 = couldnt read from source fd
return 5 = couldnt close source fd
return 6 = couldnt close dest fd
*/

#include<stdio.h>
#include<fcntl.h>
#include<sys/stat.h>
#include<unistd.h>

int copy(char *source, char *destination);

int main(int argc, char *argv[])
{
	int exit_code;

	if(argc != 3)
	{
		return -1;
	}

	exit_code = copy(argv[1], argv[2]);
	return exit_code;
}

int copy(char *source, char *destination)
{
	int fd_source;
	int fd_destination;
	char buffer[BUFSIZ];
	int dest_flags;
	mode_t permissions;
	ssize_t read_check;
	ssize_t temp_offset;

	/*compiler complains...*/
	read_check = 0;
	temp_offset = 0;
	
	fd_source = open(source, O_RDONLY);
	if(fd_source == -1)
	{
		return 1;
	}
	
	dest_flags = O_CREAT | O_WRONLY | O_TRUNC;
	
	permissions = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;

	fd_destination = open(destination, dest_flags, permissions);
	if(fd_destination == -1)
	{
		return 2;
	}
	
	while(tempoffset = sendfile(fd_destination, fd_source, read_check, BUFSIZ))
	{
		read_check += tempoffset;
	}
	if(read_check == -1)
	{
		return 4;
	}
	
	/*close fds*/
	if(close(fd_source) == -1)
	{
		return 5;
	}
	if(close(fd_destination) == -1)
	{
		return 6;
	}
	
	return 0;
}

{'fraction_non_alphanumeric': 0.11967817633255112, 'fraction_numerical': 0.016761649346295676, 'mean_word_length': 3.8284789644012944, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5035648', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1175, 'n_words': 325}