|
@@ -9,18 +9,19 @@
|
|
|
#define ERROR_H
|
|
|
|
|
|
#include <stdio.h>
|
|
|
-#include <errno.h>
|
|
|
|
|
|
|
|
|
/* --- Macro --- */
|
|
|
#define serror(str) fprintf(stderr, str" : %s\n", serrlib[serrno])
|
|
|
#define strserror(index) serrlib[index]
|
|
|
#define adderror(str) fprintf(stderr, "Erreur dans le fichier "__FILE__" ligne %d, "str"\n", __LINE__)
|
|
|
-#define addperror(str) fprintf(stderr, "Erreur dans le fichier "__FILE__" ligne %d, "str" : %s\n", __LINE__, strerror(errno))
|
|
|
+#define addperror(str) fprintf(stderr, "Erreur dans le fichier "__FILE__" ligne %d, ", __LINE__); perror(str" ")
|
|
|
#define addserror(str) fprintf(stderr, "Erreur dans le fichier "__FILE__" ligne %d, "str" : %s\n", __LINE__, strserror(serrno))
|
|
|
|
|
|
/* --- Constantes Generales --- */
|
|
|
#define ERR -1
|
|
|
+#define FAIL 0
|
|
|
+#define SUCCESS 1
|
|
|
|
|
|
/* --- Constantes Erreurs --- */
|
|
|
#define SEBADEND 1
|
|
@@ -37,5 +38,14 @@ extern int errno;
|
|
|
extern int serrno; //Shell Errno
|
|
|
extern char* serrlib[];
|
|
|
|
|
|
+/* --- Fonctions --- */
|
|
|
+/**
|
|
|
+ * Change un fd par la valeur d'un autre fd
|
|
|
+ * @param int fd accueil
|
|
|
+ * @param int fd source
|
|
|
+ * @return int Le nouveau fd du fichier qui avait le fd d'accueil
|
|
|
+ */
|
|
|
+int redirect_fd(int, int);
|
|
|
+
|
|
|
#endif /* ERROR_H */
|
|
|
|