Example #1
0
void	check_arg(char *cmd, char *args, t_label *list)
{
  if (my_strcmp(cmd, "live") == 0)
    check_live(args, cmd, list);
  else if (my_strcmp(cmd, "fork") == 0)
    check_live(args, cmd, list);
  else if (my_strcmp(cmd, "lfork") == 0)
    check_live(args, cmd, list);
  else if (my_strcmp(cmd, "zjump") == 0)
    check_live(args, cmd, list);
  else if (my_strcmp(cmd, "ld") == 0)
    check_ld(args, cmd, list);
  else if (my_strcmp(cmd, "st") == 0)
    check_st(args, cmd);
  else if (my_strcmp(cmd, "add") == 0)
    check_add(args, cmd);
  else if (my_strcmp(cmd, "sub") == 0)
    check_add(args, cmd);
  else if (my_strcmp(cmd, "and") == 0)
    check_and(args, cmd, list);
  else if (my_strcmp(cmd, "or") == 0)
    check_and(args, cmd, list);
  else if (my_strcmp(cmd, "xor") == 0)
    check_and(args, cmd, list);
  else if (my_strcmp(cmd, "ldi") == 0)
    check_ldi(args, cmd, list);
  check_argnext(cmd, args, list);
}
Example #2
0
static void match_logic(struct expression *expr)
{
	if (expr->type != EXPR_LOGICAL)
		return;

	if (expr->op == SPECIAL_LOGICAL_OR)
		check_or(expr);
	if (expr->op == SPECIAL_LOGICAL_AND)
		check_and(expr);
}
Example #3
0
File: lexer.c Project: girards/42sh
int	lex(char *str, t_token **token)
{
  int	i;

  i = 0;
  while (str[i])
    {
      i = comma_check(str, i, token);
      i = pipe_check(str, i, token);
      i = red_r(str, i, token);
      i = red_l(str, i, token);
      i = check_and(str, i, token);
      i = word_check(str, i, token);
      i = check_unk(str, i, token);
    }
  return (0);
}
Example #4
0
static char	*sort_chain(char *str, int *cur)
{
  int		tmp;
  char		*str2;

  tmp = *cur;
  *cur = move_curs(str, *cur);
  if (str[*cur] == '|' || str[*cur] == ';')
    return (check_around(tmp, *cur, str, str[*cur]));
  else if (str[*cur] == '>' && (str2 = check_redir(str, cur, tmp)))
    return (str2);
  else if (str[*cur] == '<' && (str2 = check_left_redir(str, tmp, cur)))
    return (str2);
  else if (str[*cur] == '&' && (str2 = check_and(tmp, cur, str)))
    return (str2);
  else if (!str[*cur])
    return (cut_chain(tmp, *cur, str));
  else
    return (NULL);
}