/[global]/global/htags/common.c
ViewVC logotype

Diff of /global/htags/common.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by shigio, Sun Apr 3 10:32:23 2005 UTC revision 1.21 by shigio, Sun Apr 3 10:54:50 2005 UTC
# Line 535  gen_div_end() Line 535  gen_div_end()
535  {  {
536          return "</div>";          return "</div>";
537  }  }
   
 /*  
  * Decide whether or not the path is binary file.  
  *  
  *      i)      path  
  *      r)      0: is not binary, 1: is binary  
  */  
 int  
 is_binary(path)  
         char *path;  
 {  
         int ip;  
         char buf[32];  
         int i, c, size;  
   
         ip = open(path, 0);  
         if (ip < 0)  
                 die("cannot open file '%s' in read mode.", path);  
         size = read(ip, buf, sizeof(buf));  
         close(ip);  
         if (size < 0)  
                 return 1;  
         if (!strncmp(buf, "!<arch>", 7))  
                 return 1;  
         for (i = 0; i < size; i++) {  
                 c = (unsigned char)buf[i];  
                 if (c == 0 || c > 127)  
                         return 1;  
         }  
         return 0;  
 }  

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26