command.h 877 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. pid_node* prev;
  17. pid_node* next;
  18. };
  19. typedef struct{
  20. pid_node* first;
  21. pid_node* last;
  22. }pid_list;
  23. /* --- Extern --- */
  24. extern char* cmdlist[2];
  25. /* --- Fonctions --- */
  26. void ini_pid_list(pid_list*);
  27. pid_node* add_pid(pid_list*, pid_t);
  28. pid_node* search_pid(pid_list*, pid_t);
  29. void remove_pid(pid_list*, pid_node*);
  30. void clean_pid(pid_list*);
  31. boolean is_internal_cmd(const char*);
  32. int launch_internal_command(Command*);
  33. /* --- Commandes --- */
  34. /**
  35. * Change le dossier de travail actuel
  36. * @param int argc
  37. * @param char** argv
  38. */
  39. int cd(int, char**);
  40. #endif /* COMMAND_H */