From: N. Brouard Date: Sun, 26 Feb 2006 12:57:58 +0000 (+0000) Subject: (Module): Some improvements in processing parameter X-Git-Tag: imach-099s7~515 X-Git-Url: https://henry.ined.fr/git/?a=commitdiff_plain;h=a8c8d1f3bde48d85c0374558c9242cb2a673a31d;p=.git (Module): Some improvements in processing parameter filename with strsep. --- diff --git a/src/imach.c b/src/imach.c index 3fd8b54..2cdc56d 100644 --- a/src/imach.c +++ b/src/imach.c @@ -1,6 +1,11 @@ /* $Id$ $State$ $Log$ + 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 + allocation too. + Revision 1.112 2006/01/30 09:55:26 brouard (Module): Back to gnuplot.exe instead of wgnuplot.exe @@ -4136,6 +4141,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; @@ -4213,7 +4219,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]);