blob: 502e7e1f6c9900b6d35e73fbc3fb8c990791ddab (
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
36
37
38
39
40
41
42
|
/*
* include/command.h
*
* Abstractions for parsing commands from tokens and executing them
* CISC 301 -- Operating Systems, Project 2
*
* Copyright (C) 2025 Douglas B. Rumbaugh <dbrumbaugh@harrisburgu.edu>
*
* Distributed under the Modified BSD License
*
*/
#ifndef H_HUSH_COMMAND
#define H_HUSH_COMMAND
#include <stdio.h>
#include "lexer.h"
#include "config.h"
typedef struct command {
const char *command;
const char *infile;
const char *outfile;
struct command *next;
struct command *prev;
pid_t pid;
int pipe[2];
const 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
|