--- imach/src/imach.c 2006/02/24 14:20:24 1.113 +++ imach/src/imach.c 2006/02/26 12:57:58 1.114 @@ -1,6 +1,10 @@ -/* $Id: imach.c,v 1.113 2006/02/24 14:20:24 brouard Exp $ +/* $Id: imach.c,v 1.114 2006/02/26 12:57:58 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.114 2006/02/26 12:57:58 brouard + (Module): Some improvements in processing parameter + filename with strsep. + Revision 1.113 2006/02/24 14:20:24 brouard (Module): Memory leaks checks with valgrind and: datafile was not closed, some imatrix were not freed and on matrix @@ -297,11 +301,11 @@ extern int errno; #define ODIRSEPARATOR '/' #endif -/* $Id: imach.c,v 1.113 2006/02/24 14:20:24 brouard Exp $ */ +/* $Id: imach.c,v 1.114 2006/02/26 12:57:58 brouard Exp $ */ /* $State: Exp $ */ char version[]="Imach version 0.98b, January 2006, INED-EUROREVES "; -char fullversion[]="$Revision: 1.113 $ $Date: 2006/02/24 14:20:24 $"; +char fullversion[]="$Revision: 1.114 $ $Date: 2006/02/26 12:57:58 $"; int erreur, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ int nvar; int cptcovn=0, cptcovage=0, cptcoveff=0,cptcov; @@ -4141,6 +4145,7 @@ int main(int argc, char *argv[]) char line[MAXLINE], linepar[MAXLINE]; char path[MAXLINE],pathc[MAXLINE],pathcd[MAXLINE],pathtot[MAXLINE],model[MAXLINE]; char pathr[MAXLINE], pathimach[MAXLINE]; + char **bp, *tok, *val; /* pathtot */ int firstobs=1, lastobs=10; int sdeb, sfin; /* Status at beginning and end */ int c, h , cpt,l; @@ -4218,7 +4223,17 @@ int main(int argc, char *argv[]) printf("\n%s\n%s",version,fullversion); if(argc <=1){ printf("\nEnter the parameter file name: "); - scanf("%s",pathtot); + fgets(pathr,FILENAMELENGTH,stdin); + i=strlen(pathr); + if(pathr[i-1]=='\n') + pathr[i-1]='\0'; + for (tok = pathr; tok != NULL; ){ + printf("Pathr |%s|\n",pathr); + while ((val = strsep(&tok, "\"" )) != NULL && *val == '\0'); + printf("val= |%s| pathr=%s\n",val,pathr); + strcpy (pathtot, val); + if(pathr[0] == '\0') break; /* Un peu sale */ + } } else{ strcpy(pathtot,argv[1]);