|
@@ -165,11 +165,13 @@ int set_io(Command* c, char* filename, int redir){
|
|
|
serrno = SEOPENF;
|
|
|
return SHELL_ERR;
|
|
|
}
|
|
|
- //On se met à la fin du fichier
|
|
|
- if(lseek(file, 0L, SEEK_END) == ERR){
|
|
|
- addperror("Impossible de se deplacer dans le fichier");
|
|
|
- serrno = SEOPENF;
|
|
|
- return SHELL_ERR;
|
|
|
+ //On se met à la fin du fichier si sortie ou erreur
|
|
|
+ if(redir != SHELLR_IN){
|
|
|
+ if(lseek(file, 0L, SEEK_END) == ERR){
|
|
|
+ addperror("Impossible de se deplacer dans le fichier");
|
|
|
+ serrno = SEOPENF;
|
|
|
+ return SHELL_ERR;
|
|
|
+ }
|
|
|
}
|
|
|
//Analyse dans quel descripteur il doit etre mis
|
|
|
switch(redir){
|
|
@@ -429,6 +431,16 @@ int split_command(Command* c, char* cmd){
|
|
|
cmd++;
|
|
|
delim = '"';
|
|
|
}
|
|
|
+ //Cote
|
|
|
+ else if(*cmd == '\''){
|
|
|
+ //Verif que ce n'est pas la fin
|
|
|
+ if(!(*(cmd + 1))){
|
|
|
+ serrno = SEBADCMD;
|
|
|
+ return SHELL_ERR;
|
|
|
+ }
|
|
|
+ cmd++;
|
|
|
+ delim = '\'';
|
|
|
+ }
|
|
|
//Mot sans guillemet autour
|
|
|
else {
|
|
|
length = 0;
|
|
@@ -464,6 +476,13 @@ int split_command(Command* c, char* cmd){
|
|
|
length = 0;
|
|
|
delim = '"';
|
|
|
}
|
|
|
+ //Cote
|
|
|
+ else if(*cmd == '\''){
|
|
|
+ cmd++;
|
|
|
+ deb = cmd;
|
|
|
+ length = 0;
|
|
|
+ delim = '\'';
|
|
|
+ }
|
|
|
//Mot sans guillemet autour
|
|
|
else {
|
|
|
deb = cmd;
|