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

main.c

Blame
  • Forked from sce213ta / mysh-1
    Source project has a limited visibility.
    main.c 559 B
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    #include "commands.h"
    #include "built_in.h"
    #include "utils.h"
    
    int main()
    {
      char buf[8096];
    
      putenv("PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin");
      while (1) {
        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;
    }