summaryrefslogtreecommitdiff
path: root/main.c
blob: b4f02ff886ab9c8d3cf596f04c6afc0536171f6b (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <readline/readline.h>
#include <dirent.h>
#include <unistd.h>

/* BOOLEANS */
#define true 1
#define false 0

/* SIGNALS */
#define SIGHUP  1   /* Hang up the process */ 
#define SIGINT  2   /* Interrupt the process */ 
#define SIGQUIT 3   /* Quit the process */ 
#define SIGILL  4   /* Illegal instruction. */ 
#define SIGTRAP 5   /* Trace trap. */ 
#define SIGABRT 6   /* Abort. */

void PIPELING();
void COMMAND_EXECUTION();
void REDIRECTION();
void SCRIPTING();

void ERROR_QUIT(char *CURRENT_COMMAND, char *COMMAND_INSTRUCTIONS)
{
    printf("%s", );
    
}

void err_sys(char *string)
{
    printf("%s", string);
}

void PROCESS_PID()
{
    printf("PID %ld\n", (long)getpid());
}

void LIST_CURRENT_DIRECTORY(int argc, char *argv[])
{
    DIR *dp;
    struct dirent *dirp;
    if (argc != 2)
        err_quit("usage: ls directory_name");
    if ((dp = opendir(argv[1])) == NULL)
        err_sys(argv[1]);
    while ((dirp = readdir(dp)) != NULL)
        printf("%s\n", dirp->d_name);
    closedir(dp);
}

void ECHO_INPUT(char *string)
{
    printf("%s", string);
}

int loop_shell()
{

    
    return 0;
}

int main(int argc, char *argv[]) {

    int c; 
    while ((c = getc(stdin) != EOF))
    {
        if put
    }
    LIST_CURRENT_DIRECTORY(argc, argv);
    printf("successfully started the program");

    return 0;
}