[BACK]Return to ascmagic.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / file

Diff for /src/usr.bin/file/Attic/ascmagic.c between version 1.2 and 1.3

version 1.2, 1996/06/26 05:32:54 version 1.3, 1997/02/09 23:58:18
Line 1 
Line 1 
 /*      $OpenBSD$       */  /*      $OpenBSD$       */
   
 /*  /*
  * ASCII magic -- file types that we know based on keywords   * ASCII magic -- file types that we know based on keywords
  * that can appear anywhere in the file.   * that can appear anywhere in the file.
Line 88 
Line 89 
                 return 1;                  return 1;
         }          }
   
   
           /* Make sure we are dealing with ascii text before looking for tokens */
           for (i = 0; i < nbytes; i++) {
                   if (!isascii(buf[i]))
                           return 0;       /* not all ASCII */
           }
   
         /* look for tokens from names.h - this is expensive! */          /* look for tokens from names.h - this is expensive! */
         /* make a copy of the buffer here because strtok() will destroy it */          /* make a copy of the buffer here because strtok() will destroy it */
         s = (unsigned char*) memcpy(nbuf, buf, nbytes);          s = (unsigned char*) memcpy(nbuf, buf, nbytes);
Line 104 
Line 112 
                                 return 1;                                  return 1;
                         }                          }
                 }                  }
         }  
   
   
         for (i = 0; i < nbytes; i++) {  
                 if (!isascii(buf[i]))  
                         return 0;       /* not all ASCII */  
         }          }
   
         /* all else fails, but it is ASCII... */          /* all else fails, but it is ASCII... */

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3