Path: blob/main/execution/my_mess/counting_funcs.c
1407 views
/* ************************************************************************** */1/* */2/* ::: :::::::: */3/* counting_funcs.c :+: :+: :+: */4/* +:+ +:+ +:+ */5/* By: ssabbaji <[email protected]> +#+ +:+ +#+ */6/* +#+#+#+#+#+ +#+ */7/* Created: 2022/08/09 14:48:15 by ssabbaji #+# #+# */8/* Updated: 2022/09/20 16:28:13 by ssabbaji ### ########.fr */9/* */10/* ************************************************************************** */1112#include "../../minishell.h"1314int count_cmds(char **cmd)15{16char **tmp;17int i;1819i = 0;20tmp = cmd;21while (tmp[i])22{23if (tmp)24i++;25}26return (i);27}2829int c_lstcmd(t_data *data)30{31t_cmd *lst;32int i;3334i = 0;35lst = data->lst_cmd;36while (lst)37{38i++;39lst = lst->next;40}41return (i);42}4344int count_pipes(t_data *data)45{46int i;47int count;48char **cmd;4950cmd = data->lst_cmd->cmd;51i = 0;52count = 0;53while (cmd[i])54{55if (ft_strcmp(*cmd, "|") == 0)56count++;57i++;58}59return (count);60}616263