Deleted Added
sdiff udiff text old ( 275666 ) new ( 275698 )
full compact
1/*
2 * Copyright (c) Ian F. Darwin 1986-1995.
3 * Software written by Ian F. Darwin and others;
4 * maintained 1995-present by Christos Zoulas and others.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28/*
29 * file.h - definitions for file(1) program
30 * @(#)$File: file.h,v 1.161 2014/12/04 15:56:46 christos Exp $
31 */
32
33#ifndef __file_h__
34#define __file_h__
35
36#ifdef HAVE_CONFIG_H
37#include <config.h>
38#endif

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

59#include <stdint.h>
60#endif
61#ifdef HAVE_INTTYPES_H
62#include <inttypes.h>
63#endif
64#include <regex.h>
65#include <time.h>
66#include <sys/types.h>
67#ifndef WIN32
68#include <sys/param.h>
69#endif
70/* Do this here and now, because struct stat gets re-defined on solaris */
71#include <sys/stat.h>
72#include <stdarg.h>
73
74#define ENABLE_CONDITIONALS
75
76#ifndef MAGIC
77#define MAGIC "/etc/magic"

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

398 size_t s_len; /* length of search region */
399 size_t offset; /* starting offset in source: XXX - should this be off_t? */
400 size_t rm_len; /* match length */
401 } search;
402
403 /* FIXME: Make the string dynamically allocated so that e.g.
404 strings matched in files can be longer than MAXstring */
405 union VALUETYPE ms_value; /* either number or string */
406 uint16_t indir_max;
407 uint16_t name_max;
408 uint16_t elf_shnum_max;
409 uint16_t elf_phnum_max;
410#define FILE_INDIR_MAX 15
411#define FILE_NAME_MAX 30
412#define FILE_ELF_SHNUM_MAX 32768
413#define FILE_ELF_PHNUM_MAX 128
414};
415
416/* Type for Unicode characters */
417typedef unsigned long unichar;
418
419struct stat;
420#define FILE_T_LOCAL 1
421#define FILE_T_WINDOWS 2

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

445 int);
446protected int file_ascmagic_with_encoding(struct magic_set *,
447 const unsigned char *, size_t, unichar *, size_t, const char *,
448 const char *, int);
449protected int file_encoding(struct magic_set *, const unsigned char *, size_t,
450 unichar **, size_t *, const char **, const char **, const char **);
451protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
452protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
453 uint16_t, uint16_t *, int, int);
454protected int file_apprentice(struct magic_set *, const char *, int);
455protected int buffer_apprentice(struct magic_set *, struct magic **,
456 size_t *, size_t);
457protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
458protected uint64_t file_signextend(struct magic_set *, struct magic *,
459 uint64_t);
460protected void file_badread(struct magic_set *);
461protected void file_badseek(struct magic_set *);
462protected void file_oomem(struct magic_set *, size_t);
463protected void file_error(struct magic_set *, int, const char *, ...)
464 __attribute__((__format__(__printf__, 3, 4)));

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

476 size_t *);
477protected size_t file_pstring_length_size(const struct magic *);
478protected size_t file_pstring_get_length(const struct magic *, const char *);
479#ifdef __EMX__
480protected int file_os2_apptype(struct magic_set *, const char *, const void *,
481 size_t);
482#endif /* __EMX__ */
483
484#if defined(HAVE_LOCALE_H)
485#include <locale.h>
486#endif
487#if defined(HAVE_XLOCALE_H)
488#include <xlocale.h>
489#endif
490
491typedef struct {
492 const char *pat;
493#if defined(HAVE_NEWLOCALE) && defined(HAVE_USELOCALE) && defined(HAVE_FREELOCALE)
494#define USE_C_LOCALE
495 locale_t old_lc_ctype;
496 locale_t c_lc_ctype;
497#endif
498 int rc;
499 regex_t rx;
500} file_regex_t;
501
502protected int file_regcomp(file_regex_t *, const char *, int);
503protected int file_regexec(file_regex_t *, const char *, size_t, regmatch_t *,
504 int);
505protected void file_regfree(file_regex_t *);

--- 83 unchanged lines hidden ---