parser.h 919 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * File: parser.h
  3. * Author: Arthur Brandao
  4. *
  5. * Created on 31 octobre 2018
  6. */
  7. #ifndef PARSER_H
  8. #define PARSER_H
  9. /* --- Include --- */
  10. #include "constante.h"
  11. #include "str.h"
  12. /* --- Structure --- */
  13. typedef struct{
  14. char* cmd; //La commande en string
  15. char* name; //Le nom de la commande
  16. int argc; //Le nombre d'argument
  17. char** argv; //Les arguments
  18. int input; //Descripteur de fichier d'entré
  19. int output; //Descripteur de fichier de sortie
  20. int error; //Descripteur de fihier d'erreur
  21. boolean bck; //En fond ou non
  22. int next; //Lien avec la prochaine commande
  23. }Command;
  24. typedef struct{
  25. Command** cmd; //Tableau avec toutes les commandes
  26. int length; //Taille du tableau
  27. }CommandTab;
  28. /* --- Fonctions --- */
  29. int parse_line(CommandTab*, char*);
  30. int parse_command(Command*);
  31. int parse_all_command(CommandTab*);
  32. void clean_command(CommandTab*);
  33. #endif /* PARSER_H */