Diff for /imach/src/imach.c between versions 1.276 and 1.277

version 1.276, 2017/06/30 15:48:31 version 1.277, 2017/07/17 08:53:49
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.277  2017/07/17 08:53:49  brouard
     Summary: BOM files can be read now
   
   Revision 1.276  2017/06/30 15:48:31  brouard    Revision 1.276  2017/06/30 15:48:31  brouard
   Summary: Graphs improvements    Summary: Graphs improvements
   
Line 10613  int main(int argc, char *argv[]) Line 10616  int main(int argc, char *argv[])
   int vpopbased=0;    int vpopbased=0;
   int nres=0;    int nres=0;
   int endishere=0;    int endishere=0;
     int noffset=0;
   int ncurrv=0; /* Temporary variable */    int ncurrv=0; /* Temporary variable */
       
   char ca[32], cb[32];    char ca[32], cb[32];
Line 10842  int main(int argc, char *argv[]) Line 10845  int main(int argc, char *argv[])
   
   /* Reads comments: lines beginning with '#' */    /* Reads comments: lines beginning with '#' */
   numlinepar=0;    numlinepar=0;
     /* Is it a BOM UTF-8 Windows file? */
     /* First parameter line */    /* First parameter line */
   while(fgets(line, MAXLINE, ficpar)) {    while(fgets(line, MAXLINE, ficpar)) {
       noffset=0;
       if( line[0] == (char)0xEF && line[1] == (char)0xBB) /* EF BB BF */
       {
         noffset=noffset+3;
         printf("# File is an UTF8 Bom.\n"); // 0xBF
       }
       else if( line[0] == (char)0xFE && line[1] == (char)0xFF)
       {
         noffset=noffset+2;
         printf("# File is an UTF16BE BOM file\n");
       }
       else if( line[0] == 0 && line[1] == 0)
       {
         if( line[2] == (char)0xFE && line[3] == (char)0xFF){
           noffset=noffset+4;
           printf("# File is an UTF16BE BOM file\n");
         }
       } else{
         ;/*printf(" Not a BOM file\n");*/
       }
     
     /* If line starts with a # it is a comment */      /* If line starts with a # it is a comment */
     if (line[0] == '#') {      if (line[noffset] == '#') {
       numlinepar++;        numlinepar++;
       fputs(line,stdout);        fputs(line,stdout);
       fputs(line,ficparo);        fputs(line,ficparo);

Removed from v.1.276  
changed lines
  Added in v.1.277


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>