示例#1
0
/* binary_sexp -- compute a binary schema exp */
PRIVATE env binary_sexp(mergeop f, tree t, env e)
{
     env e1 = sort_env(tc_sexp(t->x_arg1, e));
     env e2 = sort_env(tc_sexp(t->x_arg2, e));
     env ee = new_env(e);
     def d1, d2;

     d1 = pop_def(e1);
     d2 = pop_def(e2);
     while (d1 != NULL || d2 != NULL) {
	  int c = (d1 == NULL ? 1 : d2 == NULL ? -1 
		   : my_compare(&d1, &d2));
	  if (c < 0) {
	       (*f)(d1, (def) NULL, ee, t);
	       d1 = pop_def(e1);
	  }
	  else if (c > 0) {
	       (*f)((def) NULL, d2, ee, t);
	       d2 = pop_def(e2);
	  }
	  else {
	       (*f)(d1, d2, ee, t);
	       d1 = pop_def(e1);
	       d2 = pop_def(e2);
	  }
     }
     return ee;
}
示例#2
0
int	my_exec(char *binaire, char **args, char *str, t_test *test)
{
  pid_t	pid;
  char	*tmp;
  int	error;
  int	fd;

  error = 0;
  tmp = my_dotslash(binaire);
  if ((pid = fork()) == 0)
    {
      if (str != NULL)
	{
	  if ((fd = open("temp", O_RDWR | O_APPEND | O_CREAT, S_IRWXU)) < 0)
	    exit (1);
	  dup2(fd, 1);
	}
      if ((execvp(tmp, args)) == -1 && (execvp(binaire, args)) == -1)
	error++;
    }
  else
    waitpid(pid, NULL, 0);
  my_compare("temp", str, test);
  free(tmp);
  return (error);
}
示例#3
0
static gint
my_search (gconstpointer a,
	   gconstpointer b)
{
  return my_compare (b, a);
}