<commit_before>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/wait.h>




int
main()
{
	char *line = NULL;
	size_t bufsize = 0;
	char ** chArray = malloc(128 * sizeof(char*));
	char *pch;
	int pos = 0;
	int arPos;
	int wc;
	int rc;	
	char osh[4] = "osh>";
	printf("%s", osh);

	getline(&line, &bufsize, stdin);
	
	pch = strtok( line, " \n");

	while(pch != NULL) {
		chArray[pos]= pch;
		pos= pos + 1;
		
		pch = strtok( NULL, " \n ");
	}

	chArray[pos] = NULL;
	
	arPos = pos-1;

	while(arPos>0 ){
		
		if(*chArray[arPos] == '|'){
			
			rc = fork();
			
			if (rc<0){
				fprintf(stderr, "fork Failed\n");
				exit(1);
			}
			else if (rc ==0) {
				execvp(chArray[arPos +1], chArray);
				printf(" shouldnt hit here");
			}
			else {
				wc = wait(NULL);
			}
			chArray[arPos] =NULL;
		}
		arPos--;

	}
	execvp(chArray[0], chArray);
	return 0;
}
<commit_msg>added in a the start of pipes<commit_after>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/wait.h>




int
main()
{
	char *line = NULL;
	size_t bufsize = 0;
	char ** chArray = malloc(128 * sizeof(char*));
	char *pch;
	int pos = 0;
	int arPos;
	int wc;
	int rc;	
	char osh[4] = "osh>";
	printf("%s", osh);

	getline(&line, &bufsize, stdin);
	
	pch = strtok( line, " \n");

	while(pch != NULL) {
		chArray[pos]= pch;
		pos= pos + 1;
		
		pch = strtok( NULL, " \n ");
	}

	chArray[pos] = NULL;
	
	arPos = pos-1;
	

	while(arPos>0 ){
		
		if(*chArray[arPos] == '|'){
			int pip[2];
			pipe(pip);
			rc = fork();
			
			if (rc<0){
				fprintf(stderr, "fork Failed\n");
				exit(1);
			}
			else if (rc ==0) {
				close(pip[0]);
				dup2(pip[1],1);
				close(pip[1]);
				
				execvp(chArray[arPos +1], chArray);
				printf(" shouldnt hit here");
			}
			else {
				wc = wait(NULL);
			}
			chArray[arPos] =NULL;
		}
		arPos--;

	}
	
	 /*  execvp(chArray[0], chArray);*/

	return 0;
}

{'fraction_non_alphanumeric': 0.2006079027355623, 'fraction_numerical': 0.0182370820668693, 'mean_word_length': 2.7264150943396226, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '2504482', 'n_tokens_mistral': 1032, 'n_tokens_neox': 866, 'n_words': 200}