Project/app_code/background.c
void parse_background(char ***b_argv,char **argv,int *tmp_argc)
{
	static int call_count=0;
	int i;
	int len;
	if(call_count!=0)
	{
		char **tmp_argv;

		tmp_argv = (*b_argv);

		for(i=0;i< *tmp_argc;i++)
		{
			free(tmp_argv[i]);
		}

		free(tmp_argv);
	}

	call_count++;
	i=0;
	
	while(strcmp(argv[i],"&")!=0)
		i++;
	
	*tmp_argc=0;
	*tmp_argc = i;

	(*b_argv) = calloc(*tmp_argc + 1,sizeof(char*));
	
	for(i=0;i < *tmp_argc ;i++)
	{
		len = strlen(argv[i]);
		(*b_argv)[i] = calloc(len + 1,1);
		strcpy((*b_argv)[i],argv[i]);

	}

	(*b_argv)[i]=NULL;

}
/*parses the arguments for bg*/
/*same as other parser*/
/*see myreadline.c to understand it*/
parses the arguments for bg
same as other parser
see myreadline.c to understand it
parses the arguments for bg same as other parser see myreadline . c to understand it
void parse_background(char ***b_argv,char **argv,int *tmp_argc)
{
	static int call_count=0;
	int i;
	int len;
	if(call_count!=0)
	{
		char **tmp_argv;
		tmp_argv = (*b_argv);
		for(i=0;i< *tmp_argc;i++)
		{
			free(tmp_argv[i]);
		}
		free(tmp_argv);
	}
	call_count++;
	i=0;
	while(strcmp(argv[i],"&")!=0)
		i++;
	*tmp_argc=0;
	*tmp_argc = i;
	(*b_argv) = calloc(*tmp_argc + 1,sizeof(char*));
	for(i=0;i < *tmp_argc ;i++)
	{
		len = strlen(argv[i]);
		(*b_argv)[i] = calloc(len + 1,1);
		strcpy((*b_argv)[i],argv[i]);
	}
	(*b_argv)[i]=NULL;
}
void parse_background ( char * * * b_argv , char * * argv , int * tmp_argc ) { static int call_count = 0 ; int i ; int len ; if ( call_count != 0 ) { char * * tmp_argv ; tmp_argv = ( * b_argv ) ; for ( i = 0 ; i < * tmp_argc ; i ++ ) { free ( tmp_argv [ i ] ) ; } free ( tmp_argv ) ; } call_count ++ ; i = 0 ; while ( strcmp ( argv [ i ] , " " ) != 0 ) i ++ ; * tmp_argc = 0 ; * tmp_argc = i ; ( * b_argv ) = calloc ( * tmp_argc + 1 , sizeof ( char * ) ) ; for ( i = 0 ; i < * tmp_argc ; i ++ ) { len = strlen ( argv [ i ] ) ; ( * b_argv ) [ i ] = calloc ( len + 1 , 1 ) ; strcpy ( ( * b_argv ) [ i ] , argv [ i ] ) ; } ( * b_argv ) [ i ] = NULL ; }
parses the arguments for bg
same as other parser
see myreadline.c to understand it
parses the arguments for bg same as other parser see myreadline . c to understand it