Explorar el Código

Ajout constante BUFFER_SIZE

Loquicom hace 6 años
padre
commit
47c660954d
Se han modificado 2 ficheros con 3 adiciones y 2 borrados
  1. 1 0
      constante.h
  2. 2 2
      mysh.c

+ 1 - 0
constante.h

@@ -9,6 +9,7 @@
 #define CONSTANTE_H
 
 /* --- General --- */
+#define BUFFER_SIZE 512
 #define SHELL_ERR -1
 #define SHELL_FAIL 0
 #define SHELL_OK 1

+ 2 - 2
mysh.c

@@ -20,7 +20,7 @@ void test_write() {
 
 /* --- Fonctions utilitaires --- */
 void show_current_dir(const char* before, const char* after) {
-    char buffer[512];
+    char buffer[BUFFER_SIZE];
     if (getcwd(buffer, sizeof (buffer)) == NULL) {
         perror("Erreur getcwd() : ");
     } else {
@@ -40,7 +40,7 @@ void show_current_dir(const char* before, const char* after) {
 int main(int argc, char* argv[]) {
 
     CommandTab ct;
-    char str[500];
+    char str[BUFFER_SIZE];
     int a;
     //Recup ligne
     //printf("%s\n", fgets(str, 500, stdin));&