aboutsummaryrefslogtreecommitdiffstats
path: root/cmd.h
blob: c094e040153975a360568121809ecf2b25e47ddb (plain) (blame)
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
#ifndef CMD_H
#define CMD_H

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

typedef enum {
    CMD_TYPE_NORMAL,
    CMD_TYPE_PIPE,
    CMD_TYPE_AND,
    CMD_TYPE_OR,
    // add more command types as needed
} CommandType;

typedef struct Command {
    CommandType type; // the type of the command
    char **args;      // an array of strings for the arguments of the command
    int argc;
    struct Command *left;  // a pointer to the left sub-command
    struct Command *right; // a pointer to the right sub-command
} Command;

int runcmd(Command *cmd);

#endif