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

Diff for /src/usr.bin/file/Attic/softmagic.c between version 1.3 and 1.4

version 1.3, 1997/02/09 23:58:36 version 1.4, 1998/07/10 15:05:27
Line 27 
Line 27 
  * 4. This notice may not be removed or altered.   * 4. This notice may not be removed or altered.
  */   */
   
   #include <sys/types.h>
 #include <stdio.h>  #include <stdio.h>
 #include <string.h>  #include <string.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <time.h>  #include <time.h>
 #include <sys/types.h>  #include <err.h>
   
 #include "file.h"  #include "file.h"
   
Line 106 
Line 107 
   
         if (tmpoff == NULL)          if (tmpoff == NULL)
                 if ((tmpoff = (int32 *) malloc(tmplen = 20)) == NULL)                  if ((tmpoff = (int32 *) malloc(tmplen = 20)) == NULL)
                         error("out of memory\n");                          err(1, "malloc");
   
         for (magindex = 0; magindex < nmagic; magindex++) {          for (magindex = 0; magindex < nmagic; magindex++) {
                 /* if main entry matches, print it... */                  /* if main entry matches, print it... */
Line 133 
Line 134 
                 if (++cont_level >= tmplen)                  if (++cont_level >= tmplen)
                         if ((tmpoff = (int32 *) realloc(tmpoff,                          if ((tmpoff = (int32 *) realloc(tmpoff,
                                                        tmplen += 20)) == NULL)                                                         tmplen += 20)) == NULL)
                                 error("out of memory\n");                                  err(1, "malloc");
                 while (magic[magindex+1].cont_level != 0 &&                  while (magic[magindex+1].cont_level != 0 &&
                        ++magindex < nmagic) {                         ++magindex < nmagic) {
                         if (cont_level >= magic[magindex].cont_level) {                          if (cont_level >= magic[magindex].cont_level) {
Line 178 
Line 179 
                                                 if ((tmpoff =                                                  if ((tmpoff =
                                                     (int32 *) realloc(tmpoff,                                                      (int32 *) realloc(tmpoff,
                                                     tmplen += 20)) == NULL)                                                      tmplen += 20)) == NULL)
                                                         error("out of memory\n");                                                          err(1, "malloc");
                                 }                                  }
                                 if (magic[magindex].flag & ADD) {                                  if (magic[magindex].flag & ADD) {
                                          magic[magindex].offset = oldoff;                                           magic[magindex].offset = oldoff;
Line 253 
Line 254 
                 break;                  break;
   
         default:          default:
                 error("invalid m->type (%d) in mprint().\n", m->type);                  errx(1, "invalid m->type (%d) in mprint().", m->type);
                 /*NOTREACHED*/                  /*NOTREACHED*/
         }          }
         return(t);          return(t);
Line 300 
Line 301 
                     ((p->hl[3]<<24)|(p->hl[2]<<16)|(p->hl[1]<<8)|(p->hl[0]));                      ((p->hl[3]<<24)|(p->hl[2]<<16)|(p->hl[1]<<8)|(p->hl[0]));
                 return 1;                  return 1;
         default:          default:
                 error("invalid type %d in mconvert().\n", m->type);                  errx(1, "invalid type %d in mconvert().", m->type);
                 return 0;                  return 0;
         }          }
 }  }
Line 433 
Line 434 
                 }                  }
                 break;                  break;
         default:          default:
                 error("invalid type %d in mcheck().\n", m->type);                  errx(1, "invalid type %d in mcheck().", m->type);
                 return 0;/*NOTREACHED*/                  return 0;/*NOTREACHED*/
         }          }
   
Line 506 
Line 507 
   
         default:          default:
                 matched = 0;                  matched = 0;
                 error("mcheck: can't happen: invalid relation %d.\n", m->reln);                  errx(1, "mcheck: can't happen: invalid relation %d.", m->reln);
                 break;/*NOTREACHED*/                  break;/*NOTREACHED*/
         }          }
   

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