Browse Source

[norm] reduce variable name lenght.

Moul 2 years ago
parent
commit
832ed83d38
8 changed files with 37 additions and 37 deletions
  1. 2 2
      src/heredoc.c
  2. 1 1
      src/parse_redirections.c
  3. 4 4
      src/pipe_exec.c
  4. 3 3
      src/pipe_parsing.c
  5. 7 7
      src/pipe_redir_parsing.c
  6. 3 3
      src/redirect.c
  7. 15 15
      src/sh.h
  8. 2 2
      src/struct.h

+ 2 - 2
src/heredoc.c

@@ -9,7 +9,7 @@
 ** wait the fork
 */
 
-void	prompt_redirection_init(t_e *e, t_pipe *p, t_pipe_redir *t, t_pipe_redir *t2)
+void	prompt_redirection_init(t_e *e, t_pipe *p, t_pr *t, t_pr *t2)
 {
 	char	*txt;
 	int		i;
@@ -39,7 +39,7 @@ void	prompt_redirection_init(t_e *e, t_pipe *p, t_pipe_redir *t, t_pipe_redir *t
 ** restore STDIN
 */
 
-void	prompt_redirection_exec(t_e *e, t_pipe *p, t_pipe_redir *t, t_pipe_redir *t2)
+void	prompt_redirection_exec(t_e *e, t_pipe *p, t_pr *t, t_pr *t2)
 {
 	int		stdfd;
 

+ 1 - 1
src/parse_redirections.c

@@ -53,7 +53,7 @@ int		check_before_after_chevron(char *str, int chev)
 ** If '&' presence: parse one way, else: parse other way
 */
 
-void	parse_and(char *str, t_pipe_redir *t, int file_pos)
+void	parse_and(char *str, t_pr *t, int file_pos)
 {
 	char	*and;
 	int		andp;

+ 4 - 4
src/pipe_exec.c

@@ -6,7 +6,7 @@
 ** Wait for infinite fork to display again promt
 */
 
-void	launch_pipes(t_e *e, t_pipe *p, t_pipe_redir **t)
+void	launch_pipes(t_e *e, t_pipe *p, t_pr **t)
 {
 	p->i = -1;
 	p->cmd_opt = (char***)malloc(sizeof(char**) * (p->nbr + 1));
@@ -43,7 +43,7 @@ void	launch_pipes(t_e *e, t_pipe *p, t_pipe_redir **t)
 ** Close previous pipe file descriptors except for first cmd to free fd
 */
 
-void	handle_multi_piping(t_e *e, t_pipe *p, t_pipe_redir *t)
+void	handle_multi_piping(t_e *e, t_pipe *p, t_pr *t)
 {
 	int		ok;
 
@@ -72,7 +72,7 @@ void	handle_multi_piping(t_e *e, t_pipe *p, t_pipe_redir *t)
 	}
 }
 
-void	inside_pipe(t_e *e, t_pipe *p, t_pipe_redir *t)
+void	inside_pipe(t_e *e, t_pipe *p, t_pr *t)
 {
 	if (ft_strstr(t->operator, ">") != NULL)
 		open_right_redirections(e, p, t);
@@ -88,7 +88,7 @@ void	inside_pipe(t_e *e, t_pipe *p, t_pipe_redir *t)
 ** execute cmd, close fd, father wait for end of son fork
 */
 
-void	launch_double_redirections(t_e *e, t_pipe *p, t_pipe_redir **t)
+void	launch_double_redirections(t_e *e, t_pipe *p, t_pr **t)
 {
 	int		fd;
 

+ 3 - 3
src/pipe_parsing.c

@@ -36,11 +36,11 @@ void	pipe_init(t_e *e, char *all_cmd)
 
 void	pipe_init_2(t_e *e, t_pipe *p, char *all_cmd)
 {
-	t_pipe_redir	**t;
+	t_pr	**t;
 
 	p->cmd_pipe = cmd_splitting(e, all_cmd, '|');
 	pipe_parsing(p, e);
-	t = (t_pipe_redir**)malloc(sizeof(t_pipe_redir*) * (p->nbr + 2));
+	t = (t_pr**)malloc(sizeof(t_pr*) * (p->nbr + 2));
 	fill_pipe_redir_data(e, p, t);
 	if (ft_strchr(t[0]->operator, '<') != NULL && t[1] != NULL && \
 			ft_strchr(t[1]->operator, '>') != NULL)
@@ -55,7 +55,7 @@ void	pipe_init_2(t_e *e, t_pipe *p, char *all_cmd)
 ** display content on structure
 */
 
-void	display_data(t_pipe_redir *t)
+void	display_data(t_pr *t)
 {
 	ft_printf("itxt: '%s', ifd: %d, operator: '%s', ofd: %d, otxt: '%s'\n",
 		t->itxt, t->ifd, t->operator, t->ofd, t->otxt);

+ 7 - 7
src/pipe_redir_parsing.c

@@ -5,7 +5,7 @@
 ** Else: fill pipe
 */
 
-void	fill_pipe_redir_data(t_e *e, t_pipe *p, t_pipe_redir **t)
+void	fill_pipe_redir_data(t_e *e, t_pipe *p, t_pr **t)
 {
 	int		j;
 
@@ -19,9 +19,9 @@ void	fill_pipe_redir_data(t_e *e, t_pipe *p, t_pipe_redir **t)
 	t[p->i] = NULL;
 }
 
-void	pipe_creation(t_pipe_redir **t, t_pipe *p, char *cmd)
+void	pipe_creation(t_pr **t, t_pipe *p, char *cmd)
 {
-	t[p->i] = (t_pipe_redir*)malloc(sizeof(t_pipe_redir));
+	t[p->i] = (t_pr*)malloc(sizeof(t_pr));
 	t[p->i]->itxt = cmd;
 	t[p->i]->ifd = 1;
 	t[p->i]->operator = "|";
@@ -44,7 +44,7 @@ void	pipe_creation(t_pipe_redir **t, t_pipe *p, char *cmd)
 ** Else, mono-redirection
 */
 
-int		parse_double_redir(t_e *e, char *str, t_pipe *p, t_pipe_redir **t)
+int		parse_double_redir(t_e *e, char *str, t_pipe *p, t_pr **t)
 {
 	int		first_chev;
 	int		snd_chev;
@@ -61,7 +61,7 @@ int		parse_double_redir(t_e *e, char *str, t_pipe *p, t_pipe_redir **t)
 		ret = parse_redirection(e, p, cmd, t);
 		ft_strdel(&cmd);
 		nchev = str[snd_chev] == str[snd_chev + 1] ? 2 : 1;
-		t[p->i] = (t_pipe_redir*)malloc(sizeof(t_pipe_redir));
+		t[p->i] = (t_pr*)malloc(sizeof(t_pr));
 		t[p->i]->itxt = NULL;
 		t[p->i]->operator = ft_strsub(&str[snd_chev], 0, nchev);
 		t[p->i]->otxt = ft_strtrim(&str[snd_chev + nchev]);
@@ -85,7 +85,7 @@ int		parse_double_redir(t_e *e, char *str, t_pipe *p, t_pipe_redir **t)
 ** Split with strsub
 */
 
-int		parse_redirection(t_e *e, t_pipe *p, char *str, t_pipe_redir **t)
+int		parse_redirection(t_e *e, t_pipe *p, char *str, t_pr **t)
 {
 	int		chev;
 	int		chev2;
@@ -101,7 +101,7 @@ int		parse_redirection(t_e *e, t_pipe *p, char *str, t_pipe_redir **t)
 		return (0);
 	fd = str[chev - 1] == '1' || str[chev - 1] == '2' ? 1 : 0;
 	nchev = str[chev] == str[chev + 1] ? 2 : 1;
-	t[p->i] = (t_pipe_redir*)malloc(sizeof(t_pipe_redir));
+	t[p->i] = (t_pr*)malloc(sizeof(t_pr));
 	t[p->i]->itxt = ft_strtrim(ft_strsub(str, 0, chev - fd));
 	t[p->i]->operator = ft_strsub(str, chev - fd, nchev + fd);
 	t[p->i]->ifd = ft_isdigit(t[p->i]->operator[0]) ? \

+ 3 - 3
src/redirect.c

@@ -7,7 +7,7 @@
 ** if > or >>: dup STDERR or STDOUT in to STDIN
 */
 
-void	open_left_redirections(t_e *e, t_pipe *p, t_pipe_redir *t)
+void	open_left_redirections(t_e *e, t_pipe *p, t_pr *t)
 {
 	if (t->operator[0] == '|')
 		return ;
@@ -29,7 +29,7 @@ void	open_left_redirections(t_e *e, t_pipe *p, t_pipe_redir *t)
 ** save stdfd, dup new fd in STDIN
 */
 
-void	open_right_redirections(t_e *e, t_pipe *p, t_pipe_redir *t)
+void	open_right_redirections(t_e *e, t_pipe *p, t_pr *t)
 {
 	if (t->ofd == -100)
 	{
@@ -54,7 +54,7 @@ void	open_right_redirections(t_e *e, t_pipe *p, t_pipe_redir *t)
 ** right_redirections: close fd_file, restore stdout
 */
 
-void	close_redirections(t_e *e, t_pipe *p, t_pipe_redir *t)
+void	close_redirections(t_e *e, t_pipe *p, t_pr *t)
 {
 	if (ft_strcmp(t->operator, "<<") != 0 && t->operator[0] != '|')
 	{

+ 15 - 15
src/sh.h

@@ -37,36 +37,36 @@ void	count_pipe_nbr(t_e *e, t_pipe *p, char *str);
 /*
 ** pipe_redir_parsing.c
 */
-void	fill_pipe_redir_data(t_e *e, t_pipe *p, t_pipe_redir **t);
-void	pipe_creation(t_pipe_redir **t, t_pipe *p, char *cmd);
-void	display_data(t_pipe_redir *t);
-int		parse_double_redir(t_e *e, char *str, t_pipe *p, t_pipe_redir **t);
-int		parse_redirection(t_e *e, t_pipe *p, char *str, t_pipe_redir **t);
+void	fill_pipe_redir_data(t_e *e, t_pipe *p, t_pr **t);
+void	pipe_creation(t_pr **t, t_pipe *p, char *cmd);
+void	display_data(t_pr *t);
+int		parse_double_redir(t_e *e, char *str, t_pipe *p, t_pr **t);
+int		parse_redirection(t_e *e, t_pipe *p, char *str, t_pr **t);
 /*
 ** parse_redirections.c
 */
 int		check_chev_is_on_non_coted_block(t_e *e, char *str, char c);
 int		check_before_after_chevron(char *str, int chev);
-void	parse_and(char *str, t_pipe_redir *t, int file_pos);
+void	parse_and(char *str, t_pr *t, int file_pos);
 /*
 ** pipe_exec.c
 */
-void	launch_pipes(t_e *e, t_pipe *p, t_pipe_redir **t);
-void	handle_multi_piping(t_e *e, t_pipe *p, t_pipe_redir *t);
-void	inside_pipe(t_e *e, t_pipe *p, t_pipe_redir *t);
-void	launch_double_redirections(t_e *e, t_pipe *p, t_pipe_redir **t);
+void	launch_pipes(t_e *e, t_pipe *p, t_pr **t);
+void	handle_multi_piping(t_e *e, t_pipe *p, t_pr *t);
+void	inside_pipe(t_e *e, t_pipe *p, t_pr *t);
+void	launch_double_redirections(t_e *e, t_pipe *p, t_pr **t);
 void	remove_cotes(char **cmd);
 /*
 ** redirect.c
 */
-void	open_left_redirections(t_e *e, t_pipe *p, t_pipe_redir *t);
-void	open_right_redirections(t_e *e, t_pipe *p, t_pipe_redir *t);
-void	close_redirections(t_e *e, t_pipe *p, t_pipe_redir *t);
+void	open_left_redirections(t_e *e, t_pipe *p, t_pr *t);
+void	open_right_redirections(t_e *e, t_pipe *p, t_pr *t);
+void	close_redirections(t_e *e, t_pipe *p, t_pr *t);
 /*
 ** heredoc.c
 */
-void	prompt_redirection_init(t_e *e, t_pipe *p, t_pipe_redir *t, t_pipe_redir *t2);
-void	prompt_redirection_exec(t_e *e, t_pipe *p, t_pipe_redir *t, t_pipe_redir *t2);
+void	prompt_redirection_init(t_e *e, t_pipe *p, t_pr *t, t_pr *t2);
+void	prompt_redirection_exec(t_e *e, t_pipe *p, t_pr *t, t_pr *t2);
 char	*prompt_heredoc(t_e *e, char *txt, char *eof, int i);
 int		here_edition(t_e *h, int heredoc);
 /*

+ 2 - 2
src/struct.h

@@ -97,13 +97,13 @@ typedef struct			s_pipe
 ** otxt: could be cmd or nothing (NULL)
 */
 
-typedef struct			s_pipe_redir
+typedef struct			s_pr
 {
 	char				*itxt;
 	int					ifd;
 	char				*operator;
 	int					ofd;
 	char				*otxt;
-}						t_pipe_redir;
+}						t_pr;
 
 #endif