aboutsummaryrefslogtreecommitdiffstats
path: root/include/command.h
blob: 3df724b2213cca99e2e777ef314b4b618976f7fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 *
 */

#ifndef H_HUSH_COMMAND
#define H_HUSH_COMMAND

#include <stdio.h>

#include "lexer.h"
#include "config.h"

typedef struct command {
  char *command;
  char *infile;
  char *outfile;
  struct command *next;
  pid_t pid;

  int pipe[2];
  int *read_pipe;

  char *args[MAX_ARGUMENT_CNT + 2];
} command;


command *commands_from_tokens(token *parsed_cmdstr, size_t *cnt);

void print_commands(FILE *file, command *cmds);

void destroy_commands(command *cmds);

int execute_command(command *cmd);

#endif