]> henry.ined.fr Git - .git/commitdiff
Summary: Adding a hack for testing purpose
authorN. Brouard <brouard@ined.fr>
Tue, 18 Aug 2015 16:28:39 +0000 (16:28 +0000)
committerN. Brouard <brouard@ined.fr>
Tue, 18 Aug 2015 16:28:39 +0000 (16:28 +0000)
After reading the title, ftol and model lines, if the comment line has
a q, starting with #q, the answer at the end of the run is quit. It
permits to run test files in batch with ctest. The former workaround was
$ echo q | imach foo.imach

src/imach.c

index 1730b1862b10deaed3281b116fd264b78f5a5ea4..8cba3b8195b2a543ef14f3a32a8e8d22ae62e760 100644 (file)
@@ -1,6 +1,9 @@
 /* $Id$
   $State$
   $Log$
+  Revision 1.194  2015/08/18 13:32:00  brouard
+  Summary:  Adding error when the covariance matrix doesn't contain the exact number of lines required by the model line.
+
   Revision 1.193  2015/08/04 07:17:42  brouard
   Summary: 0.98q4
 
@@ -5437,8 +5440,8 @@ int readdata(char datafile[], int firstobs, int lastobs, int *imax)
 
 
   if((fic=fopen(datafile,"r"))==NULL)    {
-    printf("Problem while opening datafile: %s\n", datafile);return 1;
-    fprintf(ficlog,"Problem while opening datafile: %s\n", datafile);return 1;
+    printf("Problem while opening datafile: %s\n", datafile);fflush(stdout);
+    fprintf(ficlog,"Problem while opening datafile: %s\n", datafile);fflush(ficlog);return 1;
   }
 
   i=1;
@@ -6286,7 +6289,7 @@ int main(int argc, char *argv[])
   char pathr[MAXLINE], pathimach[MAXLINE]; 
   char *tok, *val; /* pathtot */
   int firstobs=1, lastobs=10;
-  int c,  h , cpt;
+  int c,  h , cpt, c2;
   int jl=0;
   int i1, j1, jk, stepsize=0;
   int count=0;
@@ -6502,6 +6505,10 @@ int main(int argc, char *argv[])
     ungetc(c,ficpar);
     fgets(line, MAXLINE, ficpar);
     numlinepar++;
+    if(line[1]=='q'){ /* This #q will quit imach (the answer is q) */
+      z[0]=line[1];
+    }
+    /* printf("****line [1] = %c \n",line[1]); */
     fputs(line, stdout);
     //puts(line);
     fputs(line,ficparo);
@@ -7846,7 +7853,7 @@ Please run with mle=-1 to get a correct covariance matrix.\n",ageminpar,agemaxpa
   }
   end:
   while (z[0] != 'q') {
-    printf("\nType  q for exiting: ");
+    printf("\nType  q for exiting: "); fflush(stdout);
     scanf("%s",z);
   }
 }