Deleted Added
full compact
softmagic.c (74784) softmagic.c (75937)
1/*
1/*
2 * softmagic - interpret variable magic from /etc/magic
2 * softmagic - interpret variable magic from MAGIC
3 *
4 * Copyright (c) Ian F. Darwin, 1987.
5 * Written by Ian F. Darwin.
6 *
7 * This software is not subject to any license of the American Telephone
8 * and Telegraph Company or of the Regents of the University of California.
9 *
10 * Permission is granted to anyone to use this software for any purpose on

--- 19 unchanged lines hidden (view full) ---

30#include <ctype.h>
31#include <stdlib.h>
32#include <time.h>
33#include <sys/types.h>
34
35#include "file.h"
36
37#ifndef lint
3 *
4 * Copyright (c) Ian F. Darwin, 1987.
5 * Written by Ian F. Darwin.
6 *
7 * This software is not subject to any license of the American Telephone
8 * and Telegraph Company or of the Regents of the University of California.
9 *
10 * Permission is granted to anyone to use this software for any purpose on

--- 19 unchanged lines hidden (view full) ---

30#include <ctype.h>
31#include <stdlib.h>
32#include <time.h>
33#include <sys/types.h>
34
35#include "file.h"
36
37#ifndef lint
38FILE_RCSID("@(#)$Id: softmagic.c,v 1.43 2001/03/11 20:29:16 christos Exp $")
38FILE_RCSID("@(#)$Id: softmagic.c,v 1.44 2001/03/17 19:32:50 christos Exp $")
39#endif /* lint */
40
41static int match __P((struct magic *, uint32, unsigned char *, int));
42static int mget __P((union VALUETYPE *,
43 unsigned char *, struct magic *, int));
44static int mcheck __P((union VALUETYPE *, struct magic *));
45static int32 mprint __P((union VALUETYPE *, struct magic *));
46static void mdebug __P((int32, char *, int));
47static int mconvert __P((union VALUETYPE *, struct magic *));
48
39#endif /* lint */
40
41static int match __P((struct magic *, uint32, unsigned char *, int));
42static int mget __P((union VALUETYPE *,
43 unsigned char *, struct magic *, int));
44static int mcheck __P((union VALUETYPE *, struct magic *));
45static int32 mprint __P((union VALUETYPE *, struct magic *));
46static void mdebug __P((int32, char *, int));
47static int mconvert __P((union VALUETYPE *, struct magic *));
48
49extern int kflag;
50
49/*
50 * softmagic - lookup one file in database
51 * (already read from /etc/magic by apprentice.c).
52 * Passed the name and FILE * of one file to be typed.
53 */
54/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
55int
56softmagic(buf, nbytes)

--- 46 unchanged lines hidden (view full) ---

103 int magindex = 0;
104 int cont_level = 0;
105 int need_separator = 0;
106 union VALUETYPE p;
107 static int32 *tmpoff = NULL;
108 static size_t tmplen = 0;
109 int32 oldoff = 0;
110 int returnval = 0; /* if a match is found it is set to 1*/
51/*
52 * softmagic - lookup one file in database
53 * (already read from /etc/magic by apprentice.c).
54 * Passed the name and FILE * of one file to be typed.
55 */
56/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
57int
58softmagic(buf, nbytes)

--- 46 unchanged lines hidden (view full) ---

105 int magindex = 0;
106 int cont_level = 0;
107 int need_separator = 0;
108 union VALUETYPE p;
109 static int32 *tmpoff = NULL;
110 static size_t tmplen = 0;
111 int32 oldoff = 0;
112 int returnval = 0; /* if a match is found it is set to 1*/
111 extern int kflag;
112 int firstline = 1; /* a flag to print X\n X\n- X */
113 int firstline = 1; /* a flag to print X\n X\n- X */
113 struct mlist *ml;
114
115 if (tmpoff == NULL)
116 if ((tmpoff = (int32 *) malloc(tmplen = 20)) == NULL)
117 error("out of memory\n");
118
119 for (magindex = 0; magindex < nmagic; magindex++) {
120 /* if main entry matches, print it... */
121 if (!mget(&p, s, &magic[magindex], nbytes) ||

--- 456 unchanged lines hidden ---
114
115 if (tmpoff == NULL)
116 if ((tmpoff = (int32 *) malloc(tmplen = 20)) == NULL)
117 error("out of memory\n");
118
119 for (magindex = 0; magindex < nmagic; magindex++) {
120 /* if main entry matches, print it... */
121 if (!mget(&p, s, &magic[magindex], nbytes) ||

--- 456 unchanged lines hidden ---