command.h 968 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * File: command.h
  3. * Author: Arthur Brandao
  4. *
  5. * Created on 9 novembre 2018
  6. */
  7. #ifndef COMMAND_H
  8. #define COMMAND_H
  9. /* --- Include --- */
  10. #include <sys/types.h>
  11. #include "constante.h"
  12. /* --- Structure --- */
  13. typedef struct pid_node pid_node;
  14. struct pid_node{
  15. pid_t pid;
  16. int job;
  17. pid_node* prev;
  18. pid_node* next;
  19. };
  20. typedef struct{
  21. pid_node* first;
  22. pid_node* last;
  23. }pid_list;
  24. /* --- Extern --- */
  25. extern char* cmdlist[];
  26. extern boolean exitsh;
  27. /* --- Fonctions --- */
  28. void ini_pid_list(pid_list*);
  29. pid_node* add_pid(pid_list*, pid_t, int);
  30. pid_node* search_pid(pid_list*, pid_t);
  31. void remove_pid(pid_list*, pid_node*);
  32. void clean_pid(pid_list*);
  33. boolean is_internal_cmd(const char*);
  34. int launch_internal_command(Command*);
  35. /* --- Commandes --- */
  36. /**
  37. * Change le dossier de travail actuel
  38. * @param int argc
  39. * @param char** argv
  40. */
  41. int cd(int, char**);
  42. int exit_sh(int, char**);
  43. int status(int, char**);
  44. #endif /* COMMAND_H */