Skip to content
Snippets Groups Projects
Select Git revision
  • d65569e79cdbe62f2f4ca787df01b0c9ae04e2c1
  • master default
2 results

main.c

Blame
  • Forked from sce213ta / mysh-1
    1 commit ahead of the upstream repository.
    Kimjunghwan's avatar
    김정환 authored
    d65569e7
    History
    main.c 717 B
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    #include "commands.h"
    #include "built_in.h"
    #include "utils.h"
    
    #include "signal_handlers.h"
    #include <signal.h>
    #include <sys/types.h>
    #include <signal_handlers.h>
    
    int main()
    {
      char buf[8096];
    
      while (1) {
        signal(SIGINT, (void*)catch_sigint);
        signal(SIGTSTP, (void*)catch_sigtstp);
        memset(buf, NULL,8096);
    
    
        fgets(buf, 8096, stdin);
    
        struct single_command commands[512];
        int n_commands = 0;
        mysh_parse_command(buf, &n_commands, &commands);
    
        int ret = evaluate_command(n_commands, &commands);
    
        free_commands(n_commands, &commands);
        n_commands = 0;
    
        if (ret == 1) {
          break;
        }
        
      }
    
      return 0;
    }