]> henry.ined.fr Git - .git/commitdiff
(Module): Some improvements in processing parameter
authorN. Brouard <brouard@ined.fr>
Sun, 26 Feb 2006 12:57:58 +0000 (12:57 +0000)
committerN. Brouard <brouard@ined.fr>
Sun, 26 Feb 2006 12:57:58 +0000 (12:57 +0000)
filename with strsep.

src/imach.c

index 3fd8b54b0933bcb47f76614be05a585083b3bc9d..2cdc56dc1497245f40ae5a6124f8ee79131c0b62 100644 (file)
@@ -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]);