command.h 926 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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[3];
  25. extern boolean exitsh;
  26. /* --- Fonctions --- */
  27. void ini_pid_list(pid_list*);
  28. pid_node* add_pid(pid_list*, pid_t);
  29. pid_node* search_pid(pid_list*, pid_t);
  30. void remove_pid(pid_list*, pid_node*);
  31. void clean_pid(pid_list*);
  32. boolean is_internal_cmd(const char*);
  33. int launch_internal_command(Command*);
  34. /* --- Commandes --- */
  35. /**
  36. * Change le dossier de travail actuel
  37. * @param int argc
  38. * @param char** argv
  39. */
  40. int cd(int, char**);
  41. int exit_sh(int, char**);
  42. #endif /* COMMAND_H */