1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Merge ^/head r337286 through r337585.

This commit is contained in:
Dimitry Andric 2018-08-10 21:02:28 +00:00
commit f9c0a51283
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/clang700-import/; revision=337590
332 changed files with 8407 additions and 4119 deletions

View File

@ -830,6 +830,13 @@ IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
.else
IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
.endif
# When generating install media, do not allow user and group information from
# the build host to affect the contents of the distribution.
.if make(distributeworld)
DB_FROM_SRC= yes
.endif
.if defined(DB_FROM_SRC)
INSTALLFLAGS+= -N ${.CURDIR}/etc
MTREEFLAGS+= -N ${.CURDIR}/etc
@ -1936,13 +1943,17 @@ update: .PHONY
_elftoolchain_libs= lib/libelf lib/libdwarf
.endif
# libnv and libl are both requirements for config(8), which is an unconditional
# bootstrap-tool.
_config_deps= lib/libnv usr.bin/lex/lib
legacy: .PHONY
.if ${BOOTSTRAPPING} < ${MINIMUM_SUPPORTED_OSREL} && ${BOOTSTRAPPING} != 0
@echo "ERROR: Source upgrades from versions prior to ${MINIMUM_SUPPORTED_REL} are not supported."; \
false
.endif
.for _tool in tools/build ${_elftoolchain_libs} lib/libnv
.for _tool in tools/build ${_elftoolchain_libs} ${_config_deps}
${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,all,install)"; \
cd ${.CURDIR}/${_tool}; \
if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \

View File

@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20180808:
The default pager for most commands has been changed to "less". To
restore the old behavior, set PAGER="more" and MANPAGER="more -s" in
your environment.
20180731:
The jedec_ts(4) driver has been removed. A superset of its functionality
is available in the jedec_dimm(4) driver, and the manpage for that

View File

@ -32,7 +32,7 @@
.\" @(#)date.1 8.3 (Berkeley) 4/28/95
.\" $FreeBSD$
.\"
.Dd June 1, 2018
.Dd August 4, 2018
.Dt DATE 1
.Os
.Sh NAME
@ -64,6 +64,13 @@
.Nm
.Op Fl d Ar dst
.Op Fl t Ar minutes_west
.Nm
.Op Fl jnu
.Op Fl I Ns Op Ar FMT
.Op Fl f Ar input_fmt
.Op Fl r Ar ...
.Op Fl v Ar ...
.Op Ar new_date
.Sh DESCRIPTION
When invoked without arguments, the
.Nm
@ -113,6 +120,33 @@ provided rather than using the default
format.
Parsing is done using
.Xr strptime 3 .
.It Fl I Ns Op Ar FMT
Use
.St -iso8601
output format.
.Ar FMT
may be omitted, in which case the default is
.Sq date .
Valid
.Ar FMT
values are
.Sq date ,
.Sq hours ,
.Sq minutes ,
and
.Sq seconds .
The date and time is formatted to the specified precision.
When
.Ar FMT
is
.Sq hours
(or the more precise
.Sq minutes
or
.Sq seconds ) ,
the
.St -iso8601
format includes the timezone.
.It Fl j
Do not try to set the date.
This allows you to use the
@ -401,6 +435,14 @@ sets the time to
.Li "2:32 PM" ,
without modifying the date.
.Pp
The command
.Pp
.Dl "TZ=America/Los_Angeles date -Iseconds -r 1533415339"
.Pp
will display
.Pp
.Dl "2018-08-04T13:42:19-07:00"
.Pp
Finally the command:
.Pp
.Dl "date -j -f ""%a %b %d %T %Z %Y"" ""`date`"" ""+%s"""
@ -425,6 +467,19 @@ between
and
.Xr timed 8
fails.
.Pp
It is invalid to combine the
.Fl I
flag with either
.Fl R
or an output format
.Dq ( + Ns ... )
operand.
If this occurs,
.Nm
prints:
.Ql multiple output formats specified
and exits with an error status.
.Sh SEE ALSO
.Xr locale 1 ,
.Xr gettimeofday 2 ,
@ -443,12 +498,22 @@ The
utility is expected to be compatible with
.St -p1003.2 .
The
.Fl d , f , j , n , r , t ,
.Fl d , f , I , j , n , r , t ,
and
.Fl v
options are all extensions to the standard.
.Pp
The format selected by the
.Fl I
flag is compatible with
.St -iso8601 .
.Sh HISTORY
A
.Nm
command appeared in
.At v1 .
.Pp
The
.Fl I
flag was added in
.Fx 12.0 .

View File

@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <ctype.h>
#include <err.h>
#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -68,10 +69,25 @@ __FBSDID("$FreeBSD$");
static time_t tval;
int retval;
static void setthetime(const char *, const char *, int, int);
static void badformat(void);
static void iso8601_usage(const char *);
static void multipleformats(void);
static void printdate(const char *);
static void printisodate(struct tm *);
static void setthetime(const char *, const char *, int, int);
static void usage(void);
static const struct iso8601_fmt {
const char *refname;
const char *format_string;
} iso8601_fmts[] = {
{ "date", "%Y-%m-%d" },
{ "hours", "T%H" },
{ "minutes", ":%M" },
{ "seconds", ":%S" },
};
static const struct iso8601_fmt *iso8601_selected;
static const char *rfc2822_format = "%a, %d %b %Y %T %z";
int
@ -79,7 +95,7 @@ main(int argc, char *argv[])
{
struct timezone tz;
int ch, rflag;
int jflag, nflag, Rflag;
bool Iflag, jflag, nflag, Rflag;
const char *format;
char buf[1024];
char *endptr, *fmt;
@ -89,15 +105,16 @@ main(int argc, char *argv[])
const struct vary *badv;
struct tm *lt;
struct stat sb;
size_t i;
v = NULL;
fmt = NULL;
(void) setlocale(LC_TIME, "");
tz.tz_dsttime = tz.tz_minuteswest = 0;
rflag = 0;
jflag = nflag = Rflag = 0;
Iflag = jflag = nflag = Rflag = 0;
set_timezone = 0;
while ((ch = getopt(argc, argv, "d:f:jnRr:t:uv:")) != -1)
while ((ch = getopt(argc, argv, "d:f:I::jnRr:t:uv:")) != -1)
switch((char)ch) {
case 'd': /* daylight savings time */
tz.tz_dsttime = strtol(optarg, &endptr, 10) ? 1 : 0;
@ -108,6 +125,22 @@ main(int argc, char *argv[])
case 'f':
fmt = optarg;
break;
case 'I':
if (Rflag)
multipleformats();
Iflag = 1;
if (optarg == NULL) {
iso8601_selected = iso8601_fmts;
break;
}
for (i = 0; i < nitems(iso8601_fmts); i++)
if (strcmp(optarg, iso8601_fmts[i].refname) == 0)
break;
if (i == nitems(iso8601_fmts))
iso8601_usage(optarg);
iso8601_selected = &iso8601_fmts[i];
break;
case 'j':
jflag = 1; /* don't set time */
break;
@ -115,6 +148,8 @@ main(int argc, char *argv[])
nflag = 1;
break;
case 'R': /* RFC 2822 datetime format */
if (Iflag)
multipleformats();
Rflag = 1;
break;
case 'r': /* user specified seconds */
@ -163,6 +198,8 @@ main(int argc, char *argv[])
/* allow the operands in any order */
if (*argv && **argv == '+') {
if (Iflag)
multipleformats();
format = *argv + 1;
++argv;
}
@ -173,8 +210,11 @@ main(int argc, char *argv[])
} else if (fmt != NULL)
usage();
if (*argv && **argv == '+')
if (*argv && **argv == '+') {
if (Iflag)
multipleformats();
format = *argv + 1;
}
lt = localtime(&tval);
if (lt == NULL)
@ -188,6 +228,9 @@ main(int argc, char *argv[])
}
vary_destroy(v);
if (Iflag)
printisodate(lt);
if (format == rfc2822_format)
/*
* When using RFC 2822 datetime format, don't honor the
@ -196,12 +239,40 @@ main(int argc, char *argv[])
setlocale(LC_TIME, "C");
(void)strftime(buf, sizeof(buf), format, lt);
printdate(buf);
}
static void
printdate(const char *buf)
{
(void)printf("%s\n", buf);
if (fflush(stdout))
err(1, "stdout");
exit(retval);
}
static void
printisodate(struct tm *lt)
{
const struct iso8601_fmt *it;
char fmtbuf[32], buf[32], tzbuf[8];
fmtbuf[0] = 0;
for (it = iso8601_fmts; it <= iso8601_selected; it++)
strlcat(fmtbuf, it->format_string, sizeof(fmtbuf));
(void)strftime(buf, sizeof(buf), fmtbuf, lt);
if (iso8601_selected > iso8601_fmts) {
(void)strftime(tzbuf, sizeof(tzbuf), "%z", lt);
memmove(&tzbuf[4], &tzbuf[3], 3);
tzbuf[3] = ':';
strlcat(buf, tzbuf, sizeof(buf));
}
printdate(buf);
}
#define ATOI2(s) ((s) += 2, ((s)[-2] - '0') * 10 + ((s)[-1] - '0'))
static void
@ -326,13 +397,28 @@ badformat(void)
usage();
}
static void
iso8601_usage(const char *badarg)
{
errx(1, "invalid argument '%s' for -I", badarg);
}
static void
multipleformats(void)
{
errx(1, "multiple output formats specified");
}
static void
usage(void)
{
(void)fprintf(stderr, "%s\n%s\n",
"usage: date [-jnRu] [-d dst] [-r seconds] [-t west] "
"[-v[+|-]val[ymwdHMS]] ... ",
(void)fprintf(stderr, "%s\n%s\n%s\n",
"usage: date [-jnRu] [-d dst] [-r seconds|file] [-t west] "
"[-v[+|-]val[ymwdHMS]]",
" "
"[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]");
"[-I[date | hours | minutes | seconds]]",
" "
"[-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format]"
);
exit(1);
}

View File

@ -48,6 +48,55 @@ ${desc}_test_body() {
atf_add_test_case ${desc}_test
}
iso8601_check()
{
local arg flags exp_output_1 exp_output_2
arg="${1}"
flags="${2}"
exp_output_1="${3}"
exp_output_2="${4}"
atf_check -o "inline:${exp_output_1}\n" \
date $flags -r ${TEST1} "-I${arg}"
atf_check -o "inline:${exp_output_2}\n" \
date $flags -r ${TEST2} "-I${arg}"
}
iso8601_string_test()
{
local desc arg exp_output_1 exp_output_2 flags
desc="${1}"
arg="${2}"
flags="${3}"
exp_output_1="${4}"
exp_output_2="${5}"
atf_test_case iso8601_${desc}_test
eval "
iso8601_${desc}_test_body() {
iso8601_check '${arg}' '${flags}' '${exp_output_1}' '${exp_output_2}'
}"
atf_add_test_case iso8601_${desc}_test
if [ -z "$flags" ]; then
atf_test_case iso8601_${desc}_parity
eval "
iso8601_${desc}_parity_body() {
local exp1 exp2
atf_require_prog gdate
exp1=\"\$(gdate --date '@${TEST1}' '-I${arg}')\"
exp2=\"\$(gdate --date '@${TEST2}' '-I${arg}')\"
iso8601_check '${arg}' '' \"\${exp1}\" \"\${exp2}\"
}"
atf_add_test_case iso8601_${desc}_parity
fi
}
atf_init_test_cases()
{
format_string_test A A Saturday Monday
@ -89,4 +138,12 @@ atf_init_test_cases()
format_string_test z z +0000 +0000
format_string_test percent % % %
format_string_test plus + "Sat Feb 7 07:04:03 UTC 1970" "Mon Nov 12 21:20:00 UTC 2001"
iso8601_string_test default "" "" "1970-02-07" "2001-11-12"
iso8601_string_test date date "" "1970-02-07" "2001-11-12"
iso8601_string_test hours hours "" "1970-02-07T07+00:00" "2001-11-12T21+00:00"
iso8601_string_test minutes minutes "" "1970-02-07T07:04+00:00" "2001-11-12T21:20+00:00"
iso8601_string_test seconds seconds "" "1970-02-07T07:04:03+00:00" "2001-11-12T21:20:00+00:00"
# BSD date(1) does not support fractional seconds at this time.
#iso8601_string_test ns ns "" "1970-02-07T07:04:03,000000000+00:00" "2001-11-12T21:20:00,000000000+00:00"
}

View File

@ -306,6 +306,8 @@ f_status(char *arg)
ddflags |= C_NOINFO;
else if (strcmp(arg, "noxfer") == 0)
ddflags |= C_NOXFER;
else if (strcmp(arg, "progress") == 0)
ddflags |= C_PROGRESS;
else
errx(1, "unknown status %s", arg);
}

View File

@ -32,7 +32,7 @@
.\" @(#)dd.1 8.2 (Berkeley) 1/13/94
.\" $FreeBSD$
.\"
.Dd April 2, 2017
.Dd August 8, 2018
.Dt DD 1
.Os
.Sh NAME
@ -164,12 +164,14 @@ bytes per second.
Where
.Cm value
is one of the symbols from the following list.
.Bl -tag -width "noxfer"
.Bl -tag -width "progress"
.It Cm noxfer
Do not print the transfer statistics as the last line of status output.
.It Cm none
Do not print the status output.
Error messages are shown; informational messages are not.
.It Cm progress
Print basic transfer statistics once per second.
.El
.It Cm conv Ns = Ns Ar value Ns Op , Ns Ar value ...
Where

View File

@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
#include <sys/disklabel.h>
#include <sys/filio.h>
#include <sys/mtio.h>
#include <sys/time.h>
#include <assert.h>
#include <capsicum_helpers.h>
@ -89,6 +90,7 @@ const u_char *ctab; /* conversion table */
char fill_char; /* Character to fill with if defined */
size_t speed = 0; /* maximum speed, in bytes per second */
volatile sig_atomic_t need_summary;
volatile sig_atomic_t need_progress;
int
main(int argc __unused, char *argv[])
@ -102,6 +104,7 @@ main(int argc __unused, char *argv[])
err(1, "unable to enter capability mode");
(void)signal(SIGINFO, siginfo_handler);
(void)signal(SIGALRM, sigalrm_handler);
(void)signal(SIGINT, terminate);
atexit(summary);
@ -281,6 +284,14 @@ setup(void)
ctab = casetab;
}
if ((ddflags & C_PROGRESS)) {
struct itimerval timer = {
.it_interval = { .tv_sec = 1, .tv_usec = 0 },
.it_value = { .tv_sec = 1, .tv_usec = 0 },
};
setitimer(ITIMER_REAL, &timer, NULL);
}
if (clock_gettime(CLOCK_MONOTONIC, &st.start))
err(1, "clock_gettime");
}
@ -461,6 +472,9 @@ dd_in(void)
if (need_summary) {
summary();
}
if (need_progress) {
progress();
}
}
}

View File

@ -100,5 +100,6 @@ typedef struct {
#define C_STATUS 0x08000000
#define C_NOXFER 0x10000000
#define C_NOINFO 0x20000000
#define C_PROGRESS 0x40000000
#define C_PARITY (C_PAREVEN | C_PARODD | C_PARNONE | C_PARSET)

View File

@ -46,7 +46,9 @@ void pos_in(void);
void pos_out(void);
double secs_elapsed(void);
void summary(void);
void progress(void);
void siginfo_handler(int);
void sigalrm_handler(int);
void terminate(int);
void unblock(void);
void unblock_close(void);
@ -66,3 +68,4 @@ extern const u_char a2ibm_32V[], a2ibm_POSIX[];
extern u_char casetab[];
extern char fill_char;
extern volatile sig_atomic_t need_summary;
extern volatile sig_atomic_t need_progress;

View File

@ -56,6 +56,8 @@ __FBSDID("$FreeBSD$");
#include "dd.h"
#include "extern.h"
static int need_newline;
double
secs_elapsed(void)
{
@ -83,6 +85,9 @@ summary(void)
if (ddflags & C_NOINFO)
return;
if (need_newline && !need_summary)
fprintf(stderr, "\n");
secs = secs_elapsed();
(void)fprintf(stderr,
@ -102,6 +107,28 @@ summary(void)
need_summary = 0;
}
void
progress(void)
{
double secs;
static int lastlen;
int len;
secs = secs_elapsed();
len = fprintf(stderr,
"\r%ju bytes transferred in %.0f secs (%.0f bytes/sec)",
st.bytes, secs, st.bytes / secs);
if (len > 0) {
if (len < lastlen)
(void)fprintf(stderr, "%*s", len - lastlen, "");
lastlen = len;
}
need_newline = 1;
need_progress = 0;
}
/* ARGSUSED */
void
siginfo_handler(int signo __unused)
@ -110,6 +137,14 @@ siginfo_handler(int signo __unused)
need_summary = 1;
}
/* ARGSUSED */
void
sigalrm_handler(int signo __unused)
{
need_progress = 1;
}
/* ARGSUSED */
void
terminate(int sig)

View File

@ -32,7 +32,7 @@
.\" @(#)ls.1 8.7 (Berkeley) 7/29/94
.\" $FreeBSD$
.\"
.Dd January 17, 2018
.Dd August 8, 2018
.Dt LS 1
.Os
.Sh NAME
@ -132,6 +132,8 @@ after each that is a
Enable colorized output.
This option is equivalent to defining
.Ev CLICOLOR
or
.Ev COLORTERM
in the environment.
(See below.)
This functionality can be compiled out by removing the definition of
@ -628,6 +630,10 @@ The
variable still needs to reference a color capable terminal however
otherwise it is not possible to determine which color sequences to
use.
.It Ev COLORTERM
See description for
.Ev CLICOLOR
above.
.It Ev COLUMNS
If this variable contains a string representing a
decimal integer, it is used as the
@ -652,7 +658,9 @@ for more information.
.It Ev LSCOLORS
The value of this variable describes what color to use for which
attribute when colors are enabled with
.Ev CLICOLOR .
.Ev CLICOLOR
or
.Ev COLORTERM .
This string is a concatenation of pairs of the format
.Ar f Ns Ar b ,
where
@ -759,6 +767,8 @@ option for more details.
.It Ev TERM
The
.Ev CLICOLOR
and
.Ev COLORTERM
functionality depends on a terminal type with color capabilities.
.It Ev TZ
The timezone to use when displaying dates.

View File

@ -368,7 +368,7 @@ main(int argc, char *argv[])
f_listdot = 1;
/* Enabling of colours is conditional on the environment. */
if (getenv("CLICOLOR") &&
if ((getenv("CLICOLOR") || getenv("COLORTERM")) &&
(isatty(STDOUT_FILENO) || getenv("CLICOLOR_FORCE")))
#ifdef COLORLS
if (tgetent(termcapbuf, getenv("TERM")) == 1) {

View File

@ -343,13 +343,13 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "void(@)" },
{ "mod", DT_IDENT_ACTFUNC, 0, DT_ACT_MOD, DT_ATTR_STABCMN,
DT_VERS_1_2, &dt_idops_func, "_symaddr(uintptr_t)" },
#ifdef illumos
{ "msgdsize", DT_IDENT_FUNC, 0, DIF_SUBR_MSGDSIZE,
DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "size_t(mblk_t *)" },
{ "msgsize", DT_IDENT_FUNC, 0, DIF_SUBR_MSGSIZE,
DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "size_t(mblk_t *)" },
#ifdef illumos
{ "mutex_owned", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_OWNED,
DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, "int(genunix`kmutex_t *)" },

View File

@ -787,15 +787,13 @@ typedef struct mnttab_node {
static int
libzfs_mnttab_cache_compare(const void *arg1, const void *arg2)
{
const mnttab_node_t *mtn1 = arg1;
const mnttab_node_t *mtn2 = arg2;
const mnttab_node_t *mtn1 = (const mnttab_node_t *)arg1;
const mnttab_node_t *mtn2 = (const mnttab_node_t *)arg2;
int rv;
rv = strcmp(mtn1->mtn_mt.mnt_special, mtn2->mtn_mt.mnt_special);
if (rv == 0)
return (0);
return (rv > 0 ? 1 : -1);
return (AVL_ISIGN(rv));
}
void

View File

@ -272,12 +272,7 @@ zfs_snapshot_compare(const void *larg, const void *rarg)
lcreate = zfs_prop_get_int(l, ZFS_PROP_CREATETXG);
rcreate = zfs_prop_get_int(r, ZFS_PROP_CREATETXG);
if (lcreate < rcreate)
return (-1);
else if (lcreate > rcreate)
return (+1);
else
return (0);
return (AVL_CMP(lcreate, rcreate));
}
int

View File

@ -489,15 +489,10 @@ typedef struct fsavl_node {
static int
fsavl_compare(const void *arg1, const void *arg2)
{
const fsavl_node_t *fn1 = arg1;
const fsavl_node_t *fn2 = arg2;
const fsavl_node_t *fn1 = (const fsavl_node_t *)arg1;
const fsavl_node_t *fn2 = (const fsavl_node_t *)arg2;
if (fn1->fn_guid > fn2->fn_guid)
return (+1);
else if (fn1->fn_guid < fn2->fn_guid)
return (-1);
else
return (0);
return (AVL_CMP(fn1->fn_guid, fn2->fn_guid));
}
/*

View File

@ -670,6 +670,9 @@ extern zoneid_t getzoneid(void);
#define root_mount_wait() do { } while (0)
#define root_mounted() (1)
#define noinline __attribute__((noinline))
#define likely(x) __builtin_expect((x), 1)
struct file {
void *dummy;
};

View File

@ -1189,6 +1189,7 @@ note_type_gnu(unsigned int nt)
case 2: return "NT_GNU_HWCAP (Hardware capabilities)";
case 3: return "NT_GNU_BUILD_ID (Build id set by ld(1))";
case 4: return "NT_GNU_GOLD_VERSION (GNU gold version)";
case 5: return "NT_GNU_PROPERTY_TYPE_0";
default: return (note_type_unknown(nt));
}
}

View File

@ -1,3 +1,15 @@
2018-07-25 8:50 Christos Zoulas <christos@zoulas.com>
* release 5.34
2018-06-22 16:38 Christos Zoulas <christos@zoulas.com>
* Add Quad indirect offsets
2018-05-24 14:10 Christos Zoulas <christos@zoulas.com>
* Enable parsing of ELF dynamic sections to handle PIE better
2018-04-15 14:52 Christos Zoulas <christos@zoulas.com>
* release 5.33

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.13.1 from Makefile.am.
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -14,23 +14,61 @@
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
test $$am__dry = yes; \
}
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
@ -49,11 +87,6 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/config.h.in AUTHORS COPYING ChangeLog INSTALL NEWS \
README TODO compile config.guess config.sub depcomp install-sh \
missing ltmain.sh
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@ -61,6 +94,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
@ -124,6 +159,9 @@ ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in AUTHORS \
COPYING ChangeLog INSTALL NEWS README TODO compile \
config.guess config.sub depcomp install-sh ltmain.sh missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@ -178,6 +216,7 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
@ -193,6 +232,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_VISIBILITY = @HAVE_VISIBILITY@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@ -306,7 +346,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@ -327,8 +366,8 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then rm -f stamp-h1; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
@test -f $@ || rm -f stamp-h1
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
@ -357,13 +396,12 @@ distclean-libtool:
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
case "$@" in \
@ -538,10 +576,16 @@ dist-xz: distdir
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__post_remove_distdir)
@ -576,16 +620,17 @@ distcheck: dist
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_inst
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
&& $(am__cd) $(distdir)/_build/sub \
&& ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
@ -762,6 +807,8 @@ uninstall-am:
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -1,10 +1,10 @@
## README for file(1) Command ##
@(#) $File: README,v 1.53 2018/03/11 13:06:47 glen Exp $
@(#) $File: README,v 1.54 2018/05/30 03:06:56 christos Exp $
Mailing List: file@mx.gw.com [currently down]
Mailing List archives: http://mx.gw.com/pipermail/file/ [currently down]
Bug tracker: http://bugs.gw.com/ [currently down]
Mailing List: file@astron.com
Mailing List archives: http://mailman.astron.com/pipermail/file/
Bug tracker: http://bugs.astron.com/
E-mail: christos@astron.com
Build Status: https://travis-ci.org/file/file

View File

@ -1,6 +1,6 @@
# generated automatically by aclocal 1.13.1 -*- Autoconf -*-
# generated automatically by aclocal 1.15 -*- Autoconf -*-
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -20,7 +20,85 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
# visibility.m4 serial 5 (gettext-0.18.2)
dnl Copyright (C) 2005, 2008, 2010-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
dnl Tests whether the compiler supports the command-line option
dnl -fvisibility=hidden and the function and variable attributes
dnl __attribute__((__visibility__("hidden"))) and
dnl __attribute__((__visibility__("default"))).
dnl Does *not* test for __visibility__("protected") - which has tricky
dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
dnl Mac OS X.
dnl Does *not* test for __visibility__("internal") - which has processor
dnl dependent semantics.
dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
dnl "really only recommended for legacy code".
dnl Set the variable CFLAG_VISIBILITY.
dnl Defines and sets the variable HAVE_VISIBILITY.
AC_DEFUN([gl_VISIBILITY],
[
AC_REQUIRE([AC_PROG_CC])
CFLAG_VISIBILITY=
HAVE_VISIBILITY=0
if test -n "$GCC"; then
dnl First, check whether -Werror can be added to the command line, or
dnl whether it leads to an error because of some other option that the
dnl user has put into $CC $CFLAGS $CPPFLAGS.
AC_MSG_CHECKING([whether the -Werror option is usable])
AC_CACHE_VAL([gl_cv_cc_vis_werror], [
gl_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]], [[]])],
[gl_cv_cc_vis_werror=yes],
[gl_cv_cc_vis_werror=no])
CFLAGS="$gl_save_CFLAGS"])
AC_MSG_RESULT([$gl_cv_cc_vis_werror])
dnl Now check whether visibility declarations are supported.
AC_MSG_CHECKING([for simple visibility declarations])
AC_CACHE_VAL([gl_cv_cc_visibility], [
gl_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=hidden"
dnl We use the option -Werror and a function dummyfunc, because on some
dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
dnl "visibility attribute not supported in this configuration; ignored"
dnl at the first function definition in every compilation unit, and we
dnl don't want to use the option in this case.
if test $gl_cv_cc_vis_werror = yes; then
CFLAGS="$CFLAGS -Werror"
fi
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
extern __attribute__((__visibility__("default"))) int exportedvar;
extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
extern __attribute__((__visibility__("default"))) int exportedfunc (void);
void dummyfunc (void) {}
]],
[[]])],
[gl_cv_cc_visibility=yes],
[gl_cv_cc_visibility=no])
CFLAGS="$gl_save_CFLAGS"])
AC_MSG_RESULT([$gl_cv_cc_visibility])
if test $gl_cv_cc_visibility = yes; then
CFLAG_VISIBILITY="-fvisibility=hidden"
HAVE_VISIBILITY=1
fi
fi
AC_SUBST([CFLAG_VISIBILITY])
AC_SUBST([HAVE_VISIBILITY])
AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
[Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
])
# Copyright (C) 2002-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -32,10 +110,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.13'
[am__api_version='1.15'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.13.1], [],
m4_if([$1], [1.15], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@ -51,14 +129,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.13.1])dnl
[AM_AUTOMAKE_VERSION([1.15])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -103,15 +181,14 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -142,7 +219,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -333,7 +410,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -373,7 +450,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
@ -409,7 +486,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -418,6 +495,12 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
m4_define([AC_PROG_CC],
m4_defn([AC_PROG_CC])
[_AM_PROG_CC_C_O
])
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
@ -493,8 +576,8 @@ AC_REQUIRE([AC_PROG_MKDIR_P])dnl
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
# We need awk for the "check" target (and possibly the TAP driver). The
# system "awk" is bad on some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
@ -526,6 +609,51 @@ dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
# POSIX will say in a future version that running "rm -f" with no argument
# is OK; and we want to be able to make that assumption in our Makefile
# recipes. So use an aggressive probe to check that the usage we want is
# actually supported "in the wild" to an acceptable degree.
# See automake bug#10828.
# To make any issue more visible, cause the running configure to be aborted
# by default if the 'rm' program in use doesn't match our expectations; the
# user can still override this though.
if rm -f && rm -fr && rm -rf; then : OK; else
cat >&2 <<'END'
Oops!
Your 'rm' program seems unable to run without file operands specified
on the command line, even when the '-f' option is present. This is contrary
to the behaviour of most rm programs out there, and not conforming with
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
Please tell bug-automake@gnu.org about your system, including the value
of your $PATH and any error possibly output before this message. This
can help us improve future automake versions.
END
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
echo 'Configuration will proceed anyway, since you have set the' >&2
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
echo >&2
else
cat >&2 <<'END'
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: <http://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
to "yes", and re-run configure.
END
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
fi
fi
dnl The trailing newline in this macro's definition is deliberate, for
dnl backward compatibility and to allow trailing 'dnl'-style comments
dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
])
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
@ -534,7 +662,6 @@ dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT],
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
@ -556,7 +683,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -567,7 +694,7 @@ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_co
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
if test x"${install_sh}" != xset; then
if test x"${install_sh+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
@ -577,7 +704,7 @@ if test x"${install_sh}" != xset; then
fi
AC_SUBST([install_sh])])
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
# Copyright (C) 2003-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -598,7 +725,7 @@ AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -646,41 +773,9 @@ AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_CC_C_O
# --------------
# Like AC_PROG_CC_C_O, but changed for automake.
AC_DEFUN([AM_PROG_CC_C_O],
[AC_REQUIRE([AC_PROG_CC_C_O])dnl
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([compile])dnl
# FIXME: we rely on the cache variable name because
# there is no other way.
set dummy $CC
am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
if test "$am_t" != yes; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
dnl Make sure AC_PROG_CC is never called again, or it will override our
dnl setting of CC.
m4_define([AC_PROG_CC],
[m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -719,7 +814,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -748,9 +843,73 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_PROG_CC_C_O
# ---------------
# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
# to automatically call this.
AC_DEFUN([_AM_PROG_CC_C_O],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([compile])dnl
AC_LANG_PUSH([C])dnl
AC_CACHE_CHECK(
[whether $CC understands -c and -o together],
[am_cv_prog_cc_c_o],
[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
# Make sure it works both with $CC and with simple cc.
# Following AC_PROG_CC_C_O, we do the test twice because some
# compilers refuse to overwrite an existing .o file with -o,
# though they will create one.
am_cv_prog_cc_c_o=yes
for am_i in 1 2; do
if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
&& test -f conftest2.$ac_objext; then
: OK
else
am_cv_prog_cc_c_o=no
break
fi
done
rm -f core conftest*
unset am_i])
if test "$am_cv_prog_cc_c_o" != yes; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_RUN_LOG(COMMAND)
# -------------------
# Run COMMAND, save the exit status in ac_status, and log it.
# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
AC_DEFUN([AM_RUN_LOG],
[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
(exit $ac_status); }])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -831,7 +990,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
# Copyright (C) 2009-2013 Free Software Foundation, Inc.
# Copyright (C) 2009-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -891,7 +1050,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -919,7 +1078,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
# Copyright (C) 2006-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -938,7 +1097,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2013 Free Software Foundation, Inc.
# Copyright (C) 2004-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -957,76 +1116,114 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
#
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AC_SUBST([AMTAR], ['$${TAR-tar}'])
m4_if([$1], [v7],
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
# We'll loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of '-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
m4_if([$1], [v7],
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
# tar/untar a dummy directory, and stop if the command works
[m4_case([$1],
[ustar],
[# The POSIX 1988 'ustar' format is defined with fixed-size fields.
# There is notably a 21 bits limit for the UID and the GID. In fact,
# the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
# and bug#13588).
am_max_uid=2097151 # 2^21 - 1
am_max_gid=$am_max_uid
# The $UID and $GID variables are not portable, so we need to resort
# to the POSIX-mandated id(1) utility. Errors in the 'id' calls
# below are definitely unexpected, so allow the users to see them
# (that is, avoid stderr redirection).
am_uid=`id -u || echo unknown`
am_gid=`id -g || echo unknown`
AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
if test $am_uid -le $am_max_uid; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
_am_tools=none
fi
AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
if test $am_gid -le $am_max_gid; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
_am_tools=none
fi],
[pax],
[],
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Go ahead even if we have the value already cached. We do so because we
# need to set the values for the 'am__tar' and 'am__untar' variables.
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
for _am_tool in $_am_tools; do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar; do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works.
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
AM_RUN_LOG([cat conftest.dir/file])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR

View File

@ -3,7 +3,7 @@
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify

View File

@ -1,10 +1,8 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013 Free Software Foundation, Inc.
# Copyright 1992-2017 Free Software Foundation, Inc.
timestamp='2012-12-29'
timestamp='2017-01-01'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -26,12 +24,12 @@ timestamp='2012-12-29'
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
# Originally written by Per Bothner.
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
#
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
# Please send patches to <config-patches@gnu.org>.
me=`echo "$0" | sed -e 's,.*/,,'`
@ -52,9 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
2012, 2013 Free Software Foundation, Inc.
Copyright 1992-2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -136,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_SYSTEM}" in
Linux|GNU|GNU/*)
# If the system lacks a compiler, then just pick glibc.
# We could probably try harder.
LIBC=gnu
eval $set_cc_for_build
cat <<-EOF > $dummy.c
#include <features.h>
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
#else
LIBC=gnu
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
;;
esac
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@ -151,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || \
echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
earmv*)
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
machine=${arch}${endian}-unknown
;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
# to ELF recently (or will in the future) and ABI.
case "${UNAME_MACHINE_ARCH}" in
earm*)
os=netbsdelf
;;
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
@ -180,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
os=netbsd
;;
esac
# Determine ABI tags.
case "${UNAME_MACHINE_ARCH}" in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
@ -190,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
echo "${machine}-${os}${release}${abi}"
exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
@ -206,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
exit ;;
*:LibertyBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
@ -218,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:Sortix:*:*)
echo ${UNAME_MACHINE}-unknown-sortix
exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
@ -234,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
UNAME_MACHINE="alpha" ;;
UNAME_MACHINE=alpha ;;
"EV4.5 (21064)")
UNAME_MACHINE="alpha" ;;
UNAME_MACHINE=alpha ;;
"LCA4 (21066/21068)")
UNAME_MACHINE="alpha" ;;
UNAME_MACHINE=alpha ;;
"EV5 (21164)")
UNAME_MACHINE="alphaev5" ;;
UNAME_MACHINE=alphaev5 ;;
"EV5.6 (21164A)")
UNAME_MACHINE="alphaev56" ;;
UNAME_MACHINE=alphaev56 ;;
"EV5.6 (21164PC)")
UNAME_MACHINE="alphapca56" ;;
UNAME_MACHINE=alphapca56 ;;
"EV5.7 (21164PC)")
UNAME_MACHINE="alphapca57" ;;
UNAME_MACHINE=alphapca57 ;;
"EV6 (21264)")
UNAME_MACHINE="alphaev6" ;;
UNAME_MACHINE=alphaev6 ;;
"EV6.7 (21264A)")
UNAME_MACHINE="alphaev67" ;;
UNAME_MACHINE=alphaev67 ;;
"EV6.8CB (21264C)")
UNAME_MACHINE="alphaev68" ;;
UNAME_MACHINE=alphaev68 ;;
"EV6.8AL (21264B)")
UNAME_MACHINE="alphaev68" ;;
UNAME_MACHINE=alphaev68 ;;
"EV6.8CX (21264D)")
UNAME_MACHINE="alphaev68" ;;
UNAME_MACHINE=alphaev68 ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE="alphaev69" ;;
UNAME_MACHINE=alphaev69 ;;
"EV7 (21364)")
UNAME_MACHINE="alphaev7" ;;
UNAME_MACHINE=alphaev7 ;;
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
UNAME_MACHINE=alphaev79 ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
@ -342,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH="x86_64"
SUN_ARCH=x86_64
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@ -376,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
@ -562,8 +603,9 @@ EOF
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
if [ -x /usr/bin/lslpp ] ; then
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
@ -600,13 +642,13 @@ EOF
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
32) HP_ARCH=hppa2.0n ;;
64) HP_ARCH=hppa2.0w ;;
'') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;;
esac
fi
@ -645,11 +687,11 @@ EOF
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
(CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
if [ ${HP_ARCH} = hppa2.0w ]
then
eval $set_cc_for_build
@ -662,12 +704,12 @@ EOF
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
HP_ARCH="hppa2.0w"
HP_ARCH=hppa2.0w
else
HP_ARCH="hppa64"
HP_ARCH=hppa64
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@ -772,14 +814,14 @@ EOF
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@ -809,7 +851,7 @@ EOF
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:MSYS*:*)
*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
@ -857,21 +899,21 @@ EOF
exit ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@ -884,59 +926,60 @@ EOF
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
cris:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
e2k:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
k1om:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
@ -955,54 +998,69 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
or32:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
mips64el:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
openrisc*:Linux:*:*)
echo or1k-unknown-linux-${LIBC}
exit ;;
or32:Linux:*:* | or1k*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
echo sparc-unknown-linux-${LIBC}
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
echo hppa64-unknown-linux-${LIBC}
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-gnu ;;
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
*) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
echo powerpc64-unknown-linux-${LIBC}
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
echo powerpc-unknown-linux-${LIBC}
exit ;;
ppc64le:Linux:*:*)
echo powerpc64le-unknown-linux-${LIBC}
exit ;;
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC}
exit ;;
riscv32:Linux:*:* | riscv64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@ -1078,7 +1136,7 @@ EOF
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
@ -1227,6 +1285,9 @@ EOF
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
SX-ACE:SUPER-UX:*:*)
echo sxace-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
@ -1235,24 +1296,36 @@ EOF
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
eval $set_cc_for_build
if test "$UNAME_PROCESSOR" = unknown ; then
UNAME_PROCESSOR=powerpc
fi
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# Avoid executing cc on OS X 10.9, as it ships with a stub
# that puts up a graphical alert prompting to install
# developer tools. Any system running Mac OS X 10.7 or
# later (Darwin 11 and later) is required to have a 64-bit
# processor. This is not true of the ARM version of Darwin
# that Apple uses in portable devices.
UNAME_PROCESSOR=x86_64
fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
@ -1283,7 +1356,7 @@ EOF
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
if test "$cputype" = "386"; then
if test "$cputype" = 386; then
UNAME_MACHINE=i386
else
UNAME_MACHINE="$cputype"
@ -1325,7 +1398,7 @@ EOF
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
@ -1336,171 +1409,25 @@ EOF
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
amd64:Isilon\ OneFS:*:*)
echo x86_64-unknown-onefs
exit ;;
esac
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
# if !defined (ultrix)
# include <sys/param.h>
# if defined (BSD)
# if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
# else
# if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# endif
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# else
printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
c34*)
echo c34-convex-bsd
exit ;;
c38*)
echo c38-convex-bsd
exit ;;
c4*)
echo c4-convex-bsd
exit ;;
esac
fi
cat >&2 <<EOF
$0: unable to guess system type
This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
This script (version $timestamp), has failed to recognize the
operating system you are using. If your script is old, overwrite
config.guess and config.sub with the latest versions from:
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
If the version you run ($0) is already up to date, please
send the following data and any information you think might be
pertinent to <config-patches@gnu.org> in order to provide the needed
information to handle your system.
If $0 has already been updated, send the following data and any
information you think might be pertinent to config-patches@gnu.org to
provide the necessary information to handle your system.
config.guess timestamp = $timestamp

View File

@ -230,6 +230,10 @@
/* Define to 1 if you have the <vfork.h> header file. */
#undef HAVE_VFORK_H
/* Define to 1 or 0, depending whether the compiler supports simple visibility
declarations. */
#undef HAVE_VISIBILITY
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
@ -263,9 +267,6 @@
<sysmacros.h>. */
#undef MAJOR_IN_SYSMACROS
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Name of package */
#undef PACKAGE

View File

@ -1,10 +1,8 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013 Free Software Foundation, Inc.
# Copyright 1992-2017 Free Software Foundation, Inc.
timestamp='2012-12-29'
timestamp='2017-01-01'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -27,7 +25,7 @@ timestamp='2012-12-29'
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
# Please send patches to <config-patches@gnu.org>.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
@ -35,7 +33,7 @@ timestamp='2012-12-29'
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
@ -55,8 +53,7 @@ timestamp='2012-12-29'
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS
$0 [OPTION] ALIAS
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
@ -70,9 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
2012, 2013 Free Software Foundation, Inc.
Copyright 1992-2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -121,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
kopensolaris*-gnu* | cloudabi*-eabi* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@ -256,19 +251,21 @@ case $basic_machine in
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc \
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| ba \
| be32 | be64 \
| bfin \
| c4x | clipper \
| c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| e2k | epiphany \
| fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
@ -286,26 +283,30 @@ case $basic_machine in
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| nios | nios2 \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 \
| or32 \
| open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pru \
| pyramid \
| riscv32 | riscv64 \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@ -313,6 +314,7 @@ case $basic_machine in
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
@ -327,7 +329,10 @@ case $basic_machine in
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
leon|leon[3-9])
basic_machine=sparc-$basic_machine
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
@ -369,21 +374,23 @@ case $basic_machine in
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| ba-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \
| c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| e2k-* | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
@ -403,28 +410,34 @@ case $basic_machine in
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| or1k*-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pru-* \
| pyramid-* \
| riscv32-* | riscv64-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
@ -432,6 +445,7 @@ case $basic_machine in
| ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| visium-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
@ -508,6 +522,9 @@ case $basic_machine in
basic_machine=i386-pc
os=-aros
;;
asmjs)
basic_machine=asmjs-unknown
;;
aux)
basic_machine=m68k-apple
os=-aux
@ -628,6 +645,14 @@ case $basic_machine in
basic_machine=m68k-bull
os=-sysv3
;;
e500v[12])
basic_machine=powerpc-unknown
os=$os"spe"
;;
e500v[12]-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
os=$os"spe"
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
@ -769,6 +794,9 @@ case $basic_machine in
basic_machine=m68k-isi
os=-sysv
;;
leon-*|leon[3-9]-*)
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
@ -796,7 +824,7 @@ case $basic_machine in
os=-mingw64
;;
mingw32)
basic_machine=i386-pc
basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
@ -824,6 +852,10 @@ case $basic_machine in
basic_machine=powerpc-unknown
os=-morphos
;;
moxiebox)
basic_machine=moxie-unknown
os=-moxiebox
;;
msdos)
basic_machine=i386-pc
os=-msdos
@ -832,7 +864,7 @@ case $basic_machine in
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=i386-pc
basic_machine=i686-pc
os=-msys
;;
mvs)
@ -1000,7 +1032,7 @@ case $basic_machine in
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
ppcle | powerpclittle)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
@ -1010,7 +1042,7 @@ case $basic_machine in
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
ppc64le | powerpc64little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
@ -1354,29 +1386,30 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -aos* | -aros* | -cloudabi* | -sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* \
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
| -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@ -1500,9 +1533,6 @@ case $os in
-aros*)
os=-aros
;;
-kaos*)
os=-kaos
;;
-zvmoe)
os=-zvmoe
;;
@ -1511,6 +1541,8 @@ case $os in
;;
-nacl*)
;;
-ios)
;;
-none)
;;
*)
@ -1551,6 +1583,9 @@ case $basic_machine in
c4x-* | tic4x-*)
os=-coff
;;
c8051-*)
os=-elf
;;
hexagon-*)
os=-elf
;;
@ -1603,6 +1638,9 @@ case $basic_machine in
sparc-* | *-sun)
os=-sunos4.1.1
;;
pru-*)
os=-elf
;;
*-be)
os=-beos
;;

354
contrib/file/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for file 5.33.
# Generated by GNU Autoconf 2.69 for file 5.34.
#
# Report bugs to <christos@astron.com>.
#
@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='file'
PACKAGE_TARNAME='file'
PACKAGE_VERSION='5.33'
PACKAGE_STRING='file 5.33'
PACKAGE_VERSION='5.34'
PACKAGE_STRING='file 5.34'
PACKAGE_BUGREPORT='christos@astron.com'
PACKAGE_URL=''
@ -638,6 +638,8 @@ LTLIBOBJS
IS_CROSS_COMPILE_FALSE
IS_CROSS_COMPILE_TRUE
LIBOBJS
HAVE_VISIBILITY
CFLAG_VISIBILITY
OTOOL64
OTOOL
LIPO
@ -1327,7 +1329,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures file 5.33 to adapt to many kinds of systems.
\`configure' configures file 5.34 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1397,7 +1399,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of file 5.33:";;
short | recursive ) echo "Configuration of file 5.34:";;
esac
cat <<\_ACEOF
@ -1509,7 +1511,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
file configure 5.33
file configure 5.34
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -2165,7 +2167,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by file $as_me 5.33, which was
It was created by file $as_me 5.34, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2516,7 +2518,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
am__api_version='1.13'
am__api_version='1.15'
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@ -2717,8 +2719,8 @@ test "$program_suffix" != NONE &&
ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
@ -2737,7 +2739,7 @@ else
$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
fi
if test x"${install_sh}" != xset; then
if test x"${install_sh+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
@ -3031,7 +3033,7 @@ fi
# Define the identity of the package.
PACKAGE='file'
VERSION='5.33'
VERSION='5.34'
cat >>confdefs.h <<_ACEOF
@ -3065,18 +3067,65 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
mkdir_p='$(MKDIR_P)'
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
# We need awk for the "check" target (and possibly the TAP driver). The
# system "awk" is bad on some platforms.
# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AMTAR='$${TAR-tar}'
# We'll loop over all known methods to create a tar archive until one works.
_am_tools='gnutar pax cpio none'
am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
# POSIX will say in a future version that running "rm -f" with no argument
# is OK; and we want to be able to make that assumption in our Makefile
# recipes. So use an aggressive probe to check that the usage we want is
# actually supported "in the wild" to an acceptable degree.
# See automake bug#10828.
# To make any issue more visible, cause the running configure to be aborted
# by default if the 'rm' program in use doesn't match our expectations; the
# user can still override this though.
if rm -f && rm -fr && rm -rf; then : OK; else
cat >&2 <<'END'
Oops!
Your 'rm' program seems unable to run without file operands specified
on the command line, even when the '-f' option is present. This is contrary
to the behaviour of most rm programs out there, and not conforming with
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
Please tell bug-automake@gnu.org about your system, including the value
of your $PATH and any error possibly output before this message. This
can help us improve future automake versions.
END
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
echo 'Configuration will proceed anyway, since you have set the' >&2
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
echo >&2
else
cat >&2 <<'END'
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: <http://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
to "yes", and re-run configure.
END
as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
fi
fi
# Check whether --enable-silent-rules was given.
if test "${enable_silent_rules+set}" = set; then :
enableval=$enable_silent_rules;
@ -4171,6 +4220,65 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
if ${am_cv_prog_cc_c_o+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
# Make sure it works both with $CC and with simple cc.
# Following AC_PROG_CC_C_O, we do the test twice because some
# compilers refuse to overwrite an existing .o file with -o,
# though they will create one.
am_cv_prog_cc_c_o=yes
for am_i in 1 2; do
if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } \
&& test -f conftest2.$ac_objext; then
: OK
else
am_cv_prog_cc_c_o=no
break
fi
done
rm -f core conftest*
unset am_i
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
$as_echo "$am_cv_prog_cc_c_o" >&6; }
if test "$am_cv_prog_cc_c_o" != yes; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
depcc="$CC" am_compiler_list=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
@ -5050,131 +5158,6 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
$as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
if test "x$CC" != xcc; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
fi
set dummy $CC; ac_cc=`$as_echo "$2" |
sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
# Make sure it works both with $CC and with simple cc.
# We do the test twice because some compilers refuse to overwrite an
# existing .o file with -o, though they will create one.
ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
rm -f conftest2.*
if { { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } &&
test -f conftest2.$ac_objext && { { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; };
then
eval ac_cv_prog_cc_${ac_cc}_c_o=yes
if test "x$CC" != xcc; then
# Test first that cc exists at all.
if { ac_try='cc -c conftest.$ac_ext >&5'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then
ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
rm -f conftest2.*
if { { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } &&
test -f conftest2.$ac_objext && { { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; };
then
# cc works too.
:
else
# cc exists but doesn't like -o.
eval ac_cv_prog_cc_${ac_cc}_c_o=no
fi
fi
fi
else
eval ac_cv_prog_cc_${ac_cc}_c_o=no
fi
rm -f core conftest*
fi
if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
fi
# FIXME: we rely on the cache variable name because
# there is no other way.
set dummy $CC
am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
if test "$am_t" != yes; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
@ -12512,7 +12495,92 @@ CC="$lt_save_CC"
# Only expand once:
gl_VISIBILITY
CFLAG_VISIBILITY=
HAVE_VISIBILITY=0
if test -n "$GCC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5
$as_echo_n "checking whether the -Werror option is usable... " >&6; }
if ${gl_cv_cc_vis_werror+:} false; then :
$as_echo_n "(cached) " >&6
else
gl_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
gl_cv_cc_vis_werror=yes
else
gl_cv_cc_vis_werror=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$gl_save_CFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5
$as_echo "$gl_cv_cc_vis_werror" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5
$as_echo_n "checking for simple visibility declarations... " >&6; }
if ${gl_cv_cc_visibility+:} false; then :
$as_echo_n "(cached) " >&6
else
gl_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=hidden"
if test $gl_cv_cc_vis_werror = yes; then
CFLAGS="$CFLAGS -Werror"
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
extern __attribute__((__visibility__("hidden"))) int hiddenvar;
extern __attribute__((__visibility__("default"))) int exportedvar;
extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
extern __attribute__((__visibility__("default"))) int exportedfunc (void);
void dummyfunc (void) {}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
gl_cv_cc_visibility=yes
else
gl_cv_cc_visibility=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$gl_save_CFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5
$as_echo "$gl_cv_cc_visibility" >&6; }
if test $gl_cv_cc_visibility = yes; then
CFLAG_VISIBILITY="-fvisibility=hidden"
HAVE_VISIBILITY=1
fi
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_VISIBILITY $HAVE_VISIBILITY
_ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
if ${ac_cv_header_stdc+:} false; then :
@ -15066,7 +15134,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by file $as_me 5.33, which was
This file was extended by file $as_me 5.34, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -15132,7 +15200,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
file config.status 5.33
file config.status 5.34
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@ -16194,7 +16262,7 @@ $as_echo X"$mf" |
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the

View File

@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT([file],[5.33],[christos@astron.com])
AC_INIT([file],[5.34],[christos@astron.com])
AM_INIT_AUTOMAKE([subdir-objects foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

View File

@ -1,9 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2012-10-18.11; # UTC
scriptversion=2013-05-30.07; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -552,6 +552,7 @@ $ {
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.13.1 from Makefile.am.
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -14,23 +14,61 @@
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
test $$am__dry = yes; \
}
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
@ -49,7 +87,6 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@ -57,6 +94,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@ -116,6 +154,7 @@ man5dir = $(mandir)/man5
NROFF = nroff
MANS = $(man_MANS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgdatadir = @pkgdatadir@
ACLOCAL = @ACLOCAL@
@ -129,6 +168,7 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
@ -144,6 +184,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_VISIBILITY = @HAVE_VISIBILITY@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@ -256,7 +297,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@ -612,6 +652,8 @@ uninstall-man: uninstall-man1 uninstall-man3 uninstall-man4 \
tags-am uninstall uninstall-am uninstall-man uninstall-man1 \
uninstall-man3 uninstall-man4 uninstall-man5
.PRECIOUS: Makefile
file.1: Makefile file.man
@rm -f $@

View File

@ -1,5 +1,5 @@
.\" $File: file.man,v 1.129 2018/03/02 16:17:54 christos Exp $
.Dd March 2, 2018
.\" $File: file.man,v 1.131 2018/07/24 21:33:56 christos Exp $
.Dd July 25, 2018
.Dt FILE __CSECTION__
.Os
.Sh NAME
@ -353,7 +353,7 @@ This option also causes
to disregard the file size as reported by
.Xr stat 2
since on some systems it reports a zero size for raw disk partitions.
.If Fl S , Fl Fl no-sandbox
.It Fl S , Fl Fl no-sandbox
On systems where libseccomp
.Pa ( https://github.com/seccomp/libseccomp )
is available, the
@ -629,11 +629,11 @@ were written by John Gilmore from his public-domain
program, and are not covered by the above license.
.Sh BUGS
Please report bugs and send patches to the bug tracker at
.Pa http://bugs.gw.com/
.Pa http://bugs.astron.com/
or the mailing list at
.Aq file@mx.gw.com
.Aq file@astron.com
(visit
.Pa http://mx.gw.com/mailman/listinfo/file
.Pa http://mailman.astron.com/mailman/listinfo/file
first to subscribe).
.Sh TODO
Fix output so that tests for MIME and APPLE flags are not needed all

View File

@ -1,5 +1,6 @@
.\" $File: magic.man,v 1.92 2017/11/04 01:11:32 christos Exp $
.Dd Noveber 3, 2017
.It S2
.\" $File: magic.man,v 1.93 2018/06/22 20:39:49 christos Exp $
.Dd June 22, 2018
.Dt MAGIC __FSECTION__
.Os
.\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
@ -553,12 +554,12 @@ the file.
The value at that offset is read, and is used again as an offset
in the file.
Indirect offsets are of the form:
.Em (( x [[.,][bislBISL]][+\-][ y ]) .
.Em (( x [[.,][bBcCeEfFgGhHiIlmsSqQ]][+\-][ y ]) .
The value of
.Em x
is used as an offset in the file.
A byte, id3 length, short or long is read at that offset depending on the
.Em [bislBISLm]
.Em [bBcCeEfFgGhHiIlmsSqQ]
type specifier.
The value is treated as signed if
.Dq ,
@ -575,6 +576,20 @@ To that number the value of
.Em y
is added and the result is used as an offset in the file.
The default type if one is not specified is long.
The following types are recognized:
.Bl -column -offset indent "Type" "Half/Short" "Little" "Size"
.It Sy Type Sy Mnemonic Sy Endian Sy Size
.It bcBc Byte/Char N/A 1
.It efg Double Little 8
.It EFG Double Big 8
.It hs Half/Short Little 2
.It HS Half/Short Big 2
.It i ID3 Little 4
.It I ID3 Big 4
.It m Middle Middle 4
.It q Quad Little 8
.It Q Quad Big 8
.El
.Pp
That way variable length structures can be examined:
.Bd -literal -offset indent

View File

@ -1,527 +1,301 @@
#!/bin/sh
#
# $NetBSD: install-sh.in,v 1.6 2012/01/11 13:07:31 hans Exp $
# This script now also installs multiple files, but might choke on installing
# multiple files with spaces in the file names.
#
# install - install a program, script, or datafile
scriptversion=2011-11-20.07; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright (C) 1994 X Consortium
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
doit="${DOITPROG-}"
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
# put in absolute paths if you don't have them in your path; or use env. vars.
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
awkprog="${AWKPROG-awk}"
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
instcmd="$cpprog"
instflags=""
pathcompchmodcmd="$chmodprog 755"
chmodcmd="$chmodprog 755"
chowncmd=""
chgrpcmd=""
stripcmd=""
stripflags=""
rmcmd="$rmprog -f"
stripcmd=
mvcmd="$mvprog"
src=""
msrc=""
dst=""
dir_arg=""
suffix=""
suffixfmt=""
src=
dst=
dir_arg=
dst_arg=
while [ x"$1" != x ]; do
case $1 in
-b) suffix=".old"
shift
continue;;
copy_on_change=false
no_target_directory=
-B) suffixfmt="$2"
shift
shift
continue;;
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
-c) instcmd="$cpprog"
shift
continue;;
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
-d) dir_arg=true
shift
continue;;
Options:
--help display this help and exit.
--version display version info and exit.
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
-m*)
chmodcmd="$chmodprog ${1#-m}"
shift
continue;;
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
while test $# -ne 0; do
case $1 in
-c) ;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-C) copy_on_change=true;;
-s) stripcmd="$stripprog"
shift
continue;;
-d) dir_arg=true;;
-S) stripcmd="$stripprog"
stripflags="-S $2 $stripflags"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
-p) instflags="-p"
shift
continue;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
*) if [ x"$msrc" = x ]
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
msrc="$dst"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
msrc="$msrc $dst"
fi
trap '' 0;;
esac;;
src="$dst"
dst="$1"
shift
continue;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
if [ x"$dir_arg" = x ]
then
dstisfile=""
if [ ! -d "$dst" ]
then
if [ x"$msrc" = x"$src" ]
then
dstisfile=true
else
echo "install: destination is not a directory"
exit 1
fi
fi
else
msrc="$msrc $dst"
fi
if [ x"$msrc" = x ]
then
echo "install: no destination specified"
exit 1
fi
for srcarg in $msrc; do
if [ x"$dir_arg" != x ]; then
dstarg="$srcarg"
else
dstarg="$dst"
# Waiting for this to be detected by the "$instcmd $srcarg $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f "$srcarg" ]
then
doinst="$instcmd $instflags"
elif [ -d "$srcarg" ]
then
echo "install: $srcarg: not a regular file"
exit 1
elif [ "$srcarg" = "/dev/null" ]
then
doinst="$cpprog"
else
echo "install: $srcarg does not exist"
exit 1
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d "$dstarg" ]
then
dstarg="$dstarg"/`basename "$srcarg"`
fi
fi
## this sed command emulates the dirname command
dstdir=`echo "$dstarg" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$doit $mkdirprog "${pathcomp}"
if [ x"$chowncmd" != x ]; then $doit $chowncmd "${pathcomp}"; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "${pathcomp}"; else true ; fi &&
if [ x"$pathcompchmodcmd" != x ]; then $doit $pathcompchmodcmd "${pathcomp}"; else true ; fi
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
if [ -d "$dstarg" ]; then
true
else
$doit $mkdirprog "$dstarg" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dstarg"; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dstarg"; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dstarg"; else true ; fi
fi
else
if [ x"$dstisfile" = x ]
then
file=$srcarg
else
file=$dst
fi
dstfile=`basename "$file"`
dstfinal="$dstdir/$dstfile"
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Make a backup file name in the proper directory.
case x$suffixfmt in
*%*) suffix=`echo x |
$awkprog -v bname="$dstfinal" -v fmt="$suffixfmt" '
{ cnt = 0;
do {
sfx = sprintf(fmt, cnt++);
name = bname sfx;
} while (system("test -f " name) == 0);
print sfx; }' -`;;
x) ;;
*) suffix="$suffixfmt";;
esac
dstbackup="$dstfinal$suffix"
# Move or copy the file name to the temp name
$doit $doinst $srcarg "$dsttmp" &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $stripflags "$dsttmp"; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else true;fi &&
# Now rename the file to the real destination.
if [ x"$suffix" != x ] && [ -f "$dstfinal" ]
then
$doit $mvcmd "$dstfinal" "$dstbackup"
else
$doit $rmcmd -f "$dstfinal"
fi &&
$doit $mvcmd "$dsttmp" "$dstfinal"
fi
done &&
exit 0

View File

@ -133,8 +133,9 @@ $lt_unset CDPATH
# function.
progpath="$0"
unset CP
unset MV
unset RM
: ${CP="cp -f"}
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
: ${MAKE="make"}
@ -6899,7 +6900,11 @@ func_mode_link ()
# Finalize command for both is simple: just hardcode it.
if test "$hardcode_direct" = yes &&
test "$hardcode_direct_absolute" = no; then
add="$libdir/$linklib"
if test -f "$inst_prefix_dir$libdir/$linklib"; then
add="$inst_prefix_dir$libdir/$linklib"
else
add="$libdir/$linklib"
fi
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$libdir"
add="-l$name"
@ -7391,6 +7396,7 @@ func_mode_link ()
# Calculate the version variables.
major=
versuffix=
versuffix2=
verstring=
case $version_type in
none) ;;
@ -7451,6 +7457,7 @@ func_mode_link ()
func_arith $current - $age
major=.$func_arith_result
versuffix="$major.$age.$revision"
versuffix2="$major.$age"
;;
osf)
@ -7511,8 +7518,10 @@ func_mode_link ()
esac
if test "$need_version" = no; then
versuffix=
versuffix2=
else
versuffix=".0.0"
versuffix2=".0.0"
fi
fi
@ -7520,6 +7529,7 @@ func_mode_link ()
if test "$avoid_version" = yes && test "$need_version" = no; then
major=
versuffix=
versuffix2=
verstring=""
fi
@ -7630,7 +7640,7 @@ func_mode_link ()
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
;;
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
*-*-openbsd* | *-*-mirbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
;;
*-*-sco3.2v5* | *-*-sco5v6*)
@ -7653,12 +7663,14 @@ func_mode_link ()
libname_save=$libname
release_save=$release
versuffix_save=$versuffix
versuffix2_save=$versuffix2
major_save=$major
# I'm not sure if I'm treating the release correctly. I think
# release should show up in the -l (ie -lgmp5) so we don't want to
# add it in twice. Is that correct?
release=""
versuffix=""
versuffix2=""
major=""
newdeplibs=
droppeddeps=no
@ -7935,6 +7947,7 @@ EOF
;;
esac
versuffix=$versuffix_save
versuffix2=$versuffix2_save
major=$major_save
release=$release_save
libname=$libname_save
@ -9419,7 +9432,8 @@ dlpreopen='$dlprefiles'
# Directory that this library needs to be installed in:
libdir='$install_libdir'"
if test "$installed" = no && test "$need_relink" = yes; then
if test "$installed" = no && test "$need_relink" = yes && \
test -n "$relink_command"; then
$ECHO >> $output "\
relink_command=\"$relink_command\""
fi

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: animation,v 1.66 2017/10/06 15:36:38 christos Exp $
# $File: animation,v 1.68 2018/05/06 16:08:07 christos Exp $
# animation: file(1) magic for animation/movie formats
#
# animation formats
@ -1057,3 +1057,10 @@
0 string \x06\x0e\x2b\x34\x02\x05\x01\x01\x0d\x01\x02\x01\x01\x02 Material exchange container format
!:ext mxf
!:mime application/mxf
# Recognize LucasArts Smush video files (cf.
# https://wiki.multimedia.cx/index.php/Smush)
0 string ANIM
>8 string AHDR LucasArts Smush Animation Format (SAN) video
0 string SANM
>8 string SHDR LucasArts Smush v2 (SANM) video

View File

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# $File: archive,v 1.117 2018/03/17 02:11:04 christos Exp $
# $File: archive,v 1.119 2018/04/24 23:19:45 christos Exp $
# archive: file(1) magic for archive formats (see also "msdos" for self-
# extracting compressed archives)
#
@ -11,6 +11,7 @@
# Reference: https://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5&manpath=FreeBSD+8-current
# header mainly padded with nul bytes
500 quad 0
!:strength /2
# filename or extended attribute printable strings in range space null til umlaut ue
>0 ubeshort >0x1F00
>>0 ubeshort <0xFCFD
@ -261,7 +262,7 @@
#
# BSD/SVR2-and-later portable archive formats.
#
0 string =!<arch> current ar archive
0 string =!<arch>\n current ar archive
!:mime application/x-archive
>8 string __.SYMDEF random library
>68 string __.SYMDEF\ SORTED random library

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: audio,v 1.86 2018/03/11 00:53:11 christos Exp $
# $File: audio,v 1.89 2018/07/03 20:55:37 christos Exp $
# audio: file(1) magic for sound formats (see also "iff")
#
# Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
@ -858,3 +858,33 @@
2 string ADLIB- AdLib instrument data
>0 byte x \b, version %u
>1 byte x \b.%u
# CRI ADX ADPCM audio
# Used by various Sega games.
# https://en.wikipedia.org/wiki/ADX_(file_format)
# https://wiki.multimedia.cx/index.php/CRI_ADX_file
# Added by David Korth <gerbilsoft@gerbilsoft.com>
0x00 beshort 0x8000
>(2.S-2) string (c)CRI CRI ADX ADPCM audio
>>0x12 byte x v%u
>>0x04 byte 0x02 \b, pre-set prediction coefficients
>>0x04 byte 0x03 \b, standard ADX
>>0x04 byte 0x04 \b, exponential scale
>>0x04 byte 0x05 \b, AHX
>>0x08 belong x \b, %u Hz
>>0x12 byte 0x03
>>>0x02 beshort >0x2B
>>>>0x18 belong !0 \b, looping
>>0x12 byte 0x04
>>>0x02 beshort >0x37
>>>>0x24 belong !0 \b, looping
>>0x13 byte&0x08 0x08 \b, encrypted
# Lossless audio (.la) (http://www.lossless-audio.com/)
0 string LA
>2 string 03 Lossless audio version 0.3
>2 string 04 Lossless audio version 0.4
# Sony PlayStation Audio (.xa)
0 leshort 0x4158 Sony PlayStation Audio

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: cad,v 1.15 2017/06/24 15:24:56 christos Exp $
# $File: cad,v 1.16 2018/05/07 23:26:31 christos Exp $
# autocad: file(1) magic for cad files
#
@ -153,9 +153,17 @@
>>8 lelong 0xa
>>>16 leshort 0x3d3d 3D Studio model
!:mime image/x-3ds
!:extension 3ds
!:ext 3ds
# MegaCAD 2D/3D drawing (.prt)
# http://megacad.de/
# From: Markus Heidelberg <markus.heidelberg@web.de>
0 string MegaCad23\0 MegaCAD 2D/3D drawing
# Hoops CAD files
# https://docs.techsoft3d.com/visualize/3df/latest/build/general/hsf/\
# HSF_architecture.html
# Stephane Charette <stephane.charette@gmail.com>
0 string ;;\020HSF\020V OpenHSF (Hoops Stream Format)
>7 regex/9 V[.0-9]{4,5}\020 %s
!:ext hsf

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: console,v 1.35 2017/11/14 15:48:36 christos Exp $
# $File: console,v 1.40 2018/06/23 16:40:40 christos Exp $
# Console game magic
# Toby Deshane <hac@shoelace.digivill.net>
@ -47,10 +47,12 @@
# Standard iNES ROM header.
0 string NES\x1A NES ROM image (iNES)
!:mime application/x-nes-rom
>0 use nes-rom-image-ines
# Wii U Virtual Console iNES ROM header.
0 belong 0x4E455300 NES ROM image (Wii U Virtual Console)
!:mime application/x-nes-rom
>0 use nes-rom-image-ines
#------------------------------------------------------------------------------
@ -63,6 +65,7 @@
#
0 string UNIF
>4 lelong <16 NES ROM image (UNIF v%d format)
!:mime application/x-nes-rom
#------------------------------------------------------------------------------
# fds: file(1) magic for Famciom Disk System disk images
@ -81,12 +84,14 @@
# Headered version.
0 string FDS\x1A
>0x11 string *NINTENDO-HVC* Famicom Disk System disk image:
!:mime application/x-fds-disk
>>0x10 use nintendo-fds-disk-info-block
>4 byte 1 (%u side)
>4 byte !1 (%u sides)
# Unheadered version.
1 string *NINTENDO-HVC* Famicom Disk System disk image:
!:mime application/x-fds-disk
>0 use nintendo-fds-disk-info-block
#------------------------------------------------------------------------------
@ -95,6 +100,7 @@
# From: David Korth <gerbilsoft@gerbilsoft.com>
#
0 string TNES NES ROM image (Nintendo 3DS Virtual Console)
!:mime application/x-nes-rom
>4 byte 100 \b: FDS,
>>0x2010 use nintendo-fds-disk-info-block
>4 byte !100 \b: TNES mapper %u
@ -110,6 +116,8 @@
# Reference: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header
#
0x104 bequad 0xCEED6666CC0D000B Game Boy ROM image
# TODO: application/x-gameboy-color-rom for GBC.
!:mime application/x-gameboy-rom
>0x143 byte&0x80 0x80
>>0x134 string >\0 \b: "%.15s"
>0x143 byte&0x80 !0x80
@ -124,6 +132,7 @@
>>0x146 byte !0x03
>>>0x143 byte&0xC0 0x80 [CGB]
>>>0x143 byte&0xC0 0xC0 [CGB ONLY]
>0x14b byte !0x33
# Mapper.
>0x147 byte 0x00 [ROM ONLY]
@ -199,29 +208,37 @@
# TODO: Check for 32X CD?
# Sega Mega CD disc images: 2048-byte sectors.
0 string SEGADISCSYSTEM\ \ Sega Mega CD disc image
!:mime application/x-sega-cd-rom
>0 use sega-mega-drive-header
>0 byte x \b, 2048-byte sectors
0 string SEGABOOTDISC\ \ \ \ Sega Mega CD disc image
!:mime application/x-sega-cd-rom
>0 use sega-mega-drive-header
>0 byte x \b, 2048-byte sectors
# Sega Mega CD disc images: 2352-byte sectors.
0x10 string SEGADISCSYSTEM\ \ Sega Mega CD disc image
!:mime application/x-sega-cd-rom
>0x10 use sega-mega-drive-header
>0 byte x \b, 2352-byte sectors
0x10 string SEGABOOTDISC\ \ \ \ Sega Mega CD disc image
!:mime application/x-sega-cd-rom
>0x10 use sega-mega-drive-header
>0 byte x \b, 2352-byte sectors
# Sega Mega Drive, 32X, Pico, and Mega CD Boot ROM images.
0x100 string SEGA
>0x3C0 bequad 0x4D41525320434845 Sega 32X ROM image
!:mime application/x-genesis-32x-rom
>>0 use sega-mega-drive-header
>0x3C0 bequad !0x4D41525320434845
>>0x105 belong 0x5049434F Sega Pico ROM image
!:mime application/x-sega-pico-rom
>>>0 use sega-mega-drive-header
>>0x105 belong !0x5049434F
>>>0x180 beshort 0x4252 Sega Mega CD Boot ROM image
!:mime application/x-genesis-rom
>>>0x180 beshort !0x4252 Sega Mega Drive / Genesis ROM image
!:mime application/x-genesis-rom
>>>0 use sega-mega-drive-header
#------------------------------------------------------------------------------
@ -238,11 +255,13 @@
# "Sega Genesis" header.
0x280 string EAGN
>8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format):
!:mime application/x-genesis-rom
>>0 use sega-genesis-smd-header
# "Sega Mega Drive" header.
0x280 string EAMG
>8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format):
!:mime application/x-genesis-rom
>>0 use sega-genesis-smd-header
#------------------------------------------------------------------------------
@ -258,12 +277,17 @@
0 name sega-master-system-rom-header
# Machine type.
>0x0F byte&0xF0 0x30 Sega Master System
!:mime application/x-sms-rom
>0x0F byte&0xF0 0x40 Sega Master System
!:mime application/x-sms-rom
>0x0F byte&0xF0 0x50 Sega Game Gear
!:mime application/x-gamegear-rom
>0x0F byte&0xF0 0x60 Sega Game Gear
!:mime application/x-gamegear-rom
>0x0F byte&0xF0 0x70 Sega Game Gear
>0x0F byte&0xF0 <0x30 Sega Master System / Game Gear
>0x0F byte&0xF0 >0x70 Sega Master System / Game Gear
!:mime application/x-gamegear-rom
>0x0F default x Sega Master System / Game Gear
!:mime application/x-sms-rom
>0 byte x ROM image:
# Product code.
>0x0E byte&0xF0 0x10 1
@ -323,10 +347,12 @@
# 2048-byte sector version.
0 string SEGA\ SEGASATURN\ Sega Saturn disc image
!:mime application/x-saturn-rom
>0 use sega-saturn-disc-header
>0 byte x (2048-byte sectors)
# 2352-byte sector version.
0x10 string SEGA\ SEGASATURN\ Sega Saturn disc image
!:mime application/x-saturn-rom
>0x10 use sega-saturn-disc-header
>0 byte x (2352-byte sectors)
@ -347,10 +373,12 @@
# 2048-byte sector version.
0 string SEGA\ SEGAKATANA\ Sega Dreamcast disc image
!:mime application/x-dc-rom
>0 use sega-dreamcast-disc-header
>0 byte x (2048-byte sectors)
# 2352-byte sector version.
0x10 string SEGA\ SEGAKATANA\ Sega Dreamcast disc image
!:mime application/x-dc-rom
>0x10 use sega-dreamcast-disc-header
>0 byte x (2352-byte sectors)
@ -366,6 +394,7 @@
# From: David Korth <gerbilsoft@gerbilsoft.com>
#
0 bequad 0x803712400000000F Nintendo 64 ROM image
!:mime application/x-n64-rom
>0x20 string >\0 \b: "%.20s"
>0x3B string x (%.4s
>0x3F byte x \b, Rev.%02u)
@ -375,18 +404,21 @@
# Same as z64 format, but with 16-bit byteswapping.
#
0 bequad 0x3780401200000F00 Nintendo 64 ROM image (V64)
!:mime application/x-n64-rom
#------------------------------------------------------------------------------
# n64-swap2: file(1) magic for the swap2 format N64 ROM dumps
# Same as z64 format, but with swapped 16-bit words.
#
0 bequad 0x12408037000F0000 Nintendo 64 ROM image (wordswapped)
!:mime application/x-n64-rom
#------------------------------------------------------------------------------
# n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps
# Same as z64 format, but with 32-bit byteswapping.
#
0 bequad 0x401237800F000000 Nintendo 64 ROM image (32-bit byteswapped)
!:mime application/x-n64-rom
#------------------------------------------------------------------------------
# gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format
@ -396,6 +428,7 @@
# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
#
4 bequad 0x24FFAE51699AA221 Game Boy Advance ROM image
!:mime application/x-gba-rom
>0xA0 string >\0 \b: "%.12s"
>0xAC string x (%.6s
>0xBC byte x \b, Rev.%02u)
@ -408,6 +441,7 @@
# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
#
0xC0 bequad 0x24FFAE51699AA221 Nintendo DS ROM image
!:mime application/x-nintendo-ds-rom
>0x00 string >\0 \b: "%.12s"
>0x0C string x (%.6s
>0x1E byte x \b, Rev.%02u)
@ -428,6 +462,7 @@
# This is also used for loading .nds files using the MSET exploit on 3DS.
# Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp
0xC0 bequad 0xC8604FE201708FE2 Nintendo DS Slot-2 ROM image (PassMe)
!:mime application/x-nintendo-ds-rom
#------------------------------------------------------------------------------
# ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format.
@ -437,6 +472,7 @@
# - http://www.devrs.com/ngp/files/ngpctech.txt
#
0x0A string BY\ SNK\ CORPORATION Neo Geo Pocket
!:mime application/x-neo-geo-pocket-rom
>0x23 byte 0x10 Color
>0 byte x ROM image
>0x24 string >\0 \b: "%.12s"
@ -502,8 +538,10 @@
# 8 character OMF-86 object file headers.
0 beshort 0x8008
>6 string BS93 Lynx homebrew cartridge
!:mime application/x-atari-lynx-rom
>>2 beshort x \b, RAM start $%04x
>6 string LYNX Lynx cartridge
!:mime application/x-atari-lynx-rom
>>2 beshort x \b, RAM start $%04x
# Opera file system that is used on the 3DO console
@ -518,11 +556,11 @@
# Gameboy%20Sound%20System%20(.gbs).txt
0 string GBS Nintendo Gameboy Music/Audio Data
#12 string GameBoy\ Music\ Module Nintendo Gameboy Music Module
>16 string >\0 ("%s" by
>48 string >\0 %s, copyright
>80 string >\0 %s),
>3 byte x version %d,
>4 byte x %d tracks
>16 string >\0 ("%.32s" by
>48 string >\0 %.32s, copyright
>80 string >\0 %.32s),
>3 byte x version %u,
>4 byte x %u tracks
# IPS Patch Files from: From: Thomas Klausner <tk@giga.or.at>
# see http://zerosoft.zophar.net/ips.php
@ -625,11 +663,14 @@
>>0x06 byte 2 \b, Disc 3
>>0x06 byte 3 \b, Disc 4
>0x07 byte x \b, Rev.%02u)
>0x18 belong 0x5D1C9EA3
>>0x60 beshort 0x0101 \b (Unencrypted)
# Type: Nintendo GameCube disc image
# From: David Korth <gerbilsoft@gerbilsoft.com>
# Reference: http://wiibrew.org/wiki/Wii_Disc
0x1C belong 0xC2339F3D Nintendo GameCube disc image:
!:mime application/x-gamecube-rom
>0 use nintendo-gcn-disc-common
# Type: Nintendo GameCube embedded disc image
@ -639,6 +680,7 @@
0 belong 0xAE0F38A2
>0x0C belong 0x00100000
>>(8.L+0x1C) belong 0xC2339F3D Nintendo GameCube embedded disc image:
!:mime application/x-gamecube-rom
>>>(8.L) use nintendo-gcn-disc-common
# Type: Nintendo Wii disc image
@ -652,6 +694,7 @@
# Reference: http://wiibrew.org/wiki/Wii_Disc
0 string WBFS
>0x218 belong 0x5D1C9EA3 Nintendo Wii disc image (WBFS format):
!:mime application/x-wii-rom
>>0x200 use nintendo-gcn-disc-common
# Type: Nintendo GameCube/Wii disc image (CISO format)
@ -665,41 +708,61 @@
>4 lelong 0x200000
>>8 byte 1
>>>0x801C belong 0xC2339F3D Nintendo GameCube disc image (CISO format):
!:mime application/x-wii-rom
>>>>0x8000 use nintendo-gcn-disc-common
>>>0x8018 belong 0x5D1C9EA3 Nintendo Wii disc image (CISO format):
!:mime application/x-wii-rom
>>>>0x8000 use nintendo-gcn-disc-common
# Type: Nintendo GameCube/Wii disc image (GCZ format)
# Due to zlib compression, we can't get the actual disc information.
0 lelong 0xB10BC001
>4 lelong 0 Nintendo GameCube disc image (GCZ format)
!:mime application/x-gamecube-rom
>4 lelong 1 Nintendo Wii disc image (GCZ format)
>4 lelong >1 Nintendo GameCube/Wii disc image (GCZ format)
!:mime application/x-wii-rom
>4 default x Nintendo GameCube/Wii disc image (GCZ format)
# Type: Nintendo GameCube/Wii disc image (WDF format)
0 string WII\001DISC
>8 belong 1
# WDFv1
>>0x54 belong 0xC2339F3D Nintendo GameCube disc image (WDFv1 format):
!:mime application/x-gamecube-rom
>>>0x38 use nintendo-gcn-disc-common
>>0x58 belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv1 format):
!:mime application/x-wii-rom
>>>0x38 use nintendo-gcn-disc-common
>8 belong 2
# WDFv2
>>(12.L+0x1C) belong 0xC2339F3D Nintendo GameCube disc image (WDFv2 format):
!:mime application/x-gamecube-rom
>>>(12.L) use nintendo-gcn-disc-common
>>(12.L+0x18) belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv2 format):
!:mime application/x-wii-rom
>>>(12.L) use nintendo-gcn-disc-common
# Type: Nintendo GameCube/Wii disc image (WIA format)
0 string WIA\001 Nintendo
>0x48 belong 0 GameCube/Wii
>0x48 belong 1 GameCube
!:mime application/x-gamecube-rom
>0x48 belong 2 Wii
>0x48 belong >2 GameCube/Wii
!:mime application/x-wii-rom
>0x48 default x GameCube/Wii
>0x48 belong x disc image (WIA format):
>>0x58 use nintendo-gcn-disc-common
# Type: Nintendo GameCube/Wii disc image (with SDK header)
# From: David Korth <gerbilsoft@gerbilsoft.com>
# Reference: http://wiibrew.org/wiki/Wii_Disc
0 belong 0xFFFF0000
>0x18 belong 0x00000000
>>0x1C belong 0x00000000
>>>0x8018 belong 0x5D1C9EA3 Nintendo Wii SDK disc image:
>>>>0x8000 use nintendo-gcn-disc-common
>>>0x801C belong 0xC2339F3D Nintendo GameCube SDK disc image:
>>>>0x8000 use nintendo-gcn-disc-common
#------------------------------------------------------------------------------
# Nintendo 3DS file formats.
#
@ -816,6 +879,7 @@
0 byte >0
>0 byte <3
>>1 string ATARI7800 Atari 7800 ROM image
!:mime application/x-atari-7800-rom
>>>0x11 string >\0 \b: "%.32s"
# Display type.
>>>0x39 byte 0 (NTSC)

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: database,v 1.52 2017/08/13 00:21:47 christos Exp $
# $File: database,v 1.54 2018/06/23 16:37:21 christos Exp $
# database: file(1) magic for various databases
#
# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
@ -632,3 +632,15 @@
>28 lelong x \b, entries %d
>32 lelong x \b, index %d
>36 lelong x \b, seed %#x
#
# Redis RDB - https://redis.io/topics/persistence
0 string REDIS Redis RDB file,
>5 regex [0-9][0-9][0-9][0-9] version %s
# Mork database.
# Used by older versions of Mozilla Suite and Firefox,
# and current versions of Thunderbird.
# From: David Korth <gerbilsoft@gerbilsoft.com>
0 string //\ <!--\ <mdb:mork:z\ v=" Mozilla Mork database
>23 string x \b, version %.3s

View File

@ -0,0 +1,47 @@
#------------------------------------------------------------------------------
# $File: dataone,v 1.1 2018/06/06 01:16:40 christos Exp $
#
# DataONE- files from Dave Vieglais <dave.vieglais@gmail.com> &
# Pratik Shrivastava <pratikshrivastava23@gmail.com>
#
# file formats: https://cn.dataone.org/cn/v2/formats
#------------------------------------------------------------------------------
# EML (Ecological Metadata Language Format)
0 string <?xml
>&0 regex (eml)-[0-9].[0-9].[0-9]+ eml://ecoinformatics.org/%s
# onedcx (DataONE Dublin Core Extended v1.0)
>&0 regex (onedcx/v)[0-9].[0-9]+ http://ns.dataone.org/metadata/schema/onedcx/v1.0
# FGDC-STD-001-1998 (Content Standard for Digital Geospatial Metadata,
# version 001-1998)
>&0 regex fgdc FGDC-STD-001-1998
# Mercury (Oak Ridge National Lab Mercury Metadata version 1.0)
>&0 regex (mercury/terms/v)[0-9].[0-9] http://purl.org/ornl/schema/mercury/terms/v1.0
# ISOTC211 (Geographic MetaData (GMD) Extensible Markup Language)
>&0 regex isotc211
>>&0 regex eng;USA http://www.isotc211.org/2005/gmd
# ISOTC211 (NOAA Variant Geographic MetaData (GMD) Extensible Markup Language)
>>&0 regex gov.noaa.nodc:[0-9]+ http://www.isotc211.org/2005/gmd-noaa
# ISOTC211 PANGAEA Variant Geographic MetaData (GMD) Extensible Markup Language
>>&0 regex pangaea.dataset[0-9][0-9][0-9][0-9][0-9][0-9]+ http://www.isotc211.org/2005/gmd-pangaea
!:mime text/xml
# Object Reuse and Exchange Vocabulary
0 string <?xml
>&0 regex rdf
>>&0 regex openarchives http://www.openarchives.org/ore/terms
!:mime application/rdf+xml
# Dryad Metadata Application Profile Version 3.1
0 string <DryadData
>&0 regex (dryad-bibo/v)[0-9].[0-9] http://datadryad.org/profile/v3.1
!:mime text/xml

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: dbpf,v 1.1 2017/10/13 20:47:14 christos Exp $
# $File: dbpf,v 1.2 2018/05/24 18:54:40 christos Exp $
# dppf: Maxis Database Packed Files, the stored data file format used by all
# Maxis games after the Sims: http://wiki.niotso.org/DBPF
# http://www.wiki.sc4devotion.com/index.php?title=DBPF
@ -9,9 +9,7 @@
>4 ulelong x \b, version: %u.
>>8 ulelong x \b%u
>>>36 ulelong x \b, files: %u
>>24 ledate !0 \b, created: %s
>>28 ledate !0 \b, modified: %s
!:ext dbpf/package/dat/sc4
!:mime application/x-maxis-dbpf
4 ulelong 1
>8 ulelong !1
>>24 ledate !0 \b, created: %s
>>>28 ledate !0 \b, modified: %s

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: dump,v 1.16 2017/07/22 19:21:02 christos Exp $
# $File: dump,v 1.17 2018/06/26 01:07:17 christos Exp $
# dump: file(1) magic for dump file format--for new and old dump filesystems
#
# We specify both byte orders in order to recognize byte-swapped dumps.

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: elf,v 1.72 2018/02/24 19:50:04 christos Exp $
# $File: elf,v 1.74 2018/06/23 16:39:53 christos Exp $
# elf: file(1) magic for ELF executables
#
# We have to check the byte order flag to see what byte order all the
@ -50,8 +50,12 @@
!:mime application/x-executable
>16 leshort 3 shared object,
!:mime application/x-sharedlib
>16 leshort 4 core file
>16 leshort 4 core file,
!:mime application/x-coredump
# OS-specific
>7 byte 202
>>16 leshort 0xFE01 executable,
!:mime application/x-executable
# Core file detection is not reliable.
#>>>(0x38+0xcc) string >\0 of '%s'
#>>>(0x38+0x10) lelong >0 (signal %d),
@ -320,4 +324,5 @@
>7 byte 16 (FenixOS)
>7 byte 17 (Nuxi CloudABI)
>7 byte 97 (ARM)
>7 byte 202 (Cafe OS)
>7 byte 255 (embedded)

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: fsav,v 1.14 2017/03/17 21:35:28 christos Exp $
# $File: fsav,v 1.15 2018/07/16 12:30:41 christos Exp $
# fsav: file(1) magic for datafellows fsav virus definition files
# Anthon van der Neut (anthon@mnt.org)
@ -48,13 +48,15 @@
>11 string >\0 Clam AntiVirus database %-.23s
>>34 string :
>>>35 string !: \b, version
>>>>35 string x \b%-.1s
>>>>>36 string !:
>>>>35 string x \b %-.1s
>>>>>36 string !:
>>>>>>36 string x \b%-.1s
>>>>>>>37 string !:
>>>>>>>>37 string x \b%-.1s
>>>>>>>>>38 string !:
>>>>>>>>>>38 string x \b%-.1s
>>>>>>>>>>>39 string !:
>>>>>>>>>>>>39 string x \b%-.1s
>512 string \037\213 \b, gzipped
>769 string ustar\0 \b, tarred

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: images,v 1.131 2018/02/16 15:44:28 christos Exp $
# $File: images,v 1.146 2018/07/03 20:55:37 christos Exp $
# images: file(1) magic for image formats (see also "iff", and "c-lang" for
# XPM bitmaps)
#
@ -255,10 +255,12 @@
# The second word of TIFF files is the TIFF version number, 42, which has
# never changed. The TIFF specification recommends testing for it.
0 string MM\x00\x2a TIFF image data, big-endian
!:strength +70
!:mime image/tiff
>(4.L) use \^tiff_ifd
0 string II\x2a\x00 TIFF image data, little-endian
!:mime image/tiff
!:strength +70
>(4.l) use tiff_ifd
0 name tiff_ifd
@ -464,7 +466,9 @@
!:mime image/x-unknown
# GIF
# Strength set up to beat 0x55AA DOS/MBR signature word lookups (+65)
0 string GIF8 GIF image data
!:strength +80
!:mime image/gif
!:apple 8BIMGIFf
>4 string 7a \b, version 8%s,
@ -680,6 +684,8 @@
# data and image transfer, storage, etc., for the astronomical community.
# (FITS floating point formats are big-endian.)
0 string SIMPLE\ \ = FITS image data
!:mime image/fits
!:ext fits/fts
>109 string 8 \b, 8-bit, character or unsigned binary integer
>108 string 16 \b, 16-bit, two's complement binary integer
>107 string \ 32 \b, 32-bit, two's complement binary integer
@ -1392,6 +1398,115 @@
>8 ubelong x %dx
>12 ubelong x \b%d
# Type: Microsoft DirectDraw Surface (common data)
# URL: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
# From: Morten Hustveit <morten@debian.org>
# Updated by: David Korth <gerbilsoft@gerbilsoft.com>
0 name ms-directdraw-surface
>0x10 ulelong x %u x
>0x0C ulelong x %u
# Color depth.
>0x58 ulelong >0 \b, %u-bit color
# Determine the pixel format.
>0x50 ulelong&0x4 4
# FIXME: Handle DX10 and XBOX formats.
>>0x54 string x \b, compressed using %.4s
>0x50 ulelong&0x2 0x2 \b, alpha only
>0x50 ulelong&0x200 0x200 \b, YUV
>0x50 ulelong&0x20000 0x20000 \b, luminance
# RGB pixel format
>0x50 ulelong&0x40 0x40
# Determine the RGB format using the color masks.
# ulequad order: 0xGGGGGGGGRRRRRRRR, 0xAAAAAAAABBBBBBBB
>>0x58 ulelong 16
# NOTE: 15-bit color formats usually have 16-bit listed as the color depth.
>>>0x5C ulequad 0x000003E000007C00
>>>>0x64 ulequad 0x000000000000001F \b, RGB555
>>>0x5C ulequad 0x000003E000001F00
>>>>0x64 ulequad 0x000000000000007C \b, BGR555
>>>0x5C ulequad 0x000007E00000F800
>>>>0x64 ulequad 0x000000000000001F \b, RGB565
>>>0x5C ulequad 0x000007E000001F00
>>>>0x64 ulequad 0x00000000000000F8 \b, BGR565
>>>0x5C ulequad 0x000000F000000F00
>>>>0x64 ulequad 0x0000F0000000000F \b, ARGB4444
>>>0x5C ulequad 0x000000F00000000F
>>>>0x64 ulequad 0x0000F00000000F00 \b, ABGR4444
>>>0x5C ulequad 0x00000F000000F000
>>>>0x64 ulequad 0x0000000F000000F0 \b, RGBA4444
>>>0x5C ulequad 0x00000F00000000F0
>>>>0x64 ulequad 0x0000000F0000F000 \b, BGRA4444
>>>0x5C ulequad 0x000000F000000F00
>>>>0x64 ulequad 0x000000000000000F \b, xRGB4444
>>>0x5C ulequad 0x000000F00000000F
>>>>0x64 ulequad 0x0000000000000F00 \b, xBGR4444
>>>0x5C ulequad 0x00000F000000F000
>>>>0x64 ulequad 0x00000000000000F0 \b, RGBx4444
>>>0x5C ulequad 0x00000F00000000F0
>>>>0x64 ulequad 0x000000000000F000 \b, BGRx4444
>>>0x5C ulequad 0x000003E000007C00
>>>>0x64 ulequad 0x000080000000001F \b, ARGB1555
>>>0x5C ulequad 0x000003E000001F00
>>>>0x64 ulequad 0x000080000000007C \b, ABGR1555
>>>0x5C ulequad 0x000007C00000F800
>>>>0x64 ulequad 0x000000010000003E \b, RGBA5551
>>>0x5C ulequad 0x000007C00000003E
>>>>0x64 ulequad 0x000000010000F800 \b, BGRA5551
>>88 ulelong 24
>>>0x5C ulequad 0x0000FF0000FF0000
>>>>0x64 ulequad 0x00000000000000FF \b, RGB888
>>>0x5C ulequad 0x0000FF00000000FF
>>>>0x64 ulequad 0x0000000000FF0000 \b, BGR888
>>88 ulelong 32
>>>0x5C ulequad 0x0000FF0000FF0000
>>>>0x64 ulequad 0xFF000000000000FF \b, ARGB8888
>>>0x5C ulequad 0x0000FF00000000FF
>>>>0x64 ulequad 0xFF00000000FF0000 \b, ABGR8888
>>>0x5C ulequad 0x00FF0000FF000000
>>>>0x64 ulequad 0x000000FF0000FF00 \b, RGBA8888
>>>0x5C ulequad 0x00FF00000000FF00
>>>>0x64 ulequad 0x000000FFFF000000 \b, BGBA8888
>>>0x5C ulequad 0x0000FF0000FF0000
>>>>0x64 ulequad 0x00000000000000FF \b, xRGB8888
>>>0x5C ulequad 0x0000FF00000000FF
>>>>0x64 ulequad 0x0000000000FF0000 \b, xBGR8888
>>>0x5C ulequad 0x00FF0000FF000000
>>>>0x64 ulequad 0x000000000000FF00 \b, RGBx8888
>>>0x5C ulequad 0x00FF00000000FF00
>>>>0x64 ulequad 0x00000000FF000000 \b, BGBx8888
# Less common 32-bit color formats.
>>>0x5C ulequad 0xFFFF00000000FFFF
>>>>0x64 ulequad 0x0000000000000000 \b, G16R16
>>>0x5C ulequad 0x0000FFFFFFFF0000
>>>>0x64 ulequad 0x0000000000000000 \b, R16G16
>>>0x5C ulequad 0x000FFC003FF00000
>>>>0x64 ulequad 0xC0000000000003FF \b, A2R10G10B10
>>>0x5C ulequad 0x000FFC00000003FF
>>>>0x64 ulequad 0xC00000003FF00000 \b, A2B10G10R10
# Type: Microsoft DirectDraw Surface
# URL: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
# From: Morten Hustveit <morten@debian.org>
# Updated by: David Korth <gerbilsoft@gerbilsoft.com>
0 string/b DDS\040\174\000\000\000 Microsoft DirectDraw Surface (DDS):
>0 use ms-directdraw-surface
# Type: Sega PVR image.
# From: David Korth <gerbilsoft@gerbilsoft.com>
# References:
@ -1401,8 +1516,8 @@
# Sega PVR header.
0 name sega-pvr-image-header
>0x0C leshort x %d x
>0x0E leshort x %d
>0x0C leshort x %u x
>0x0E leshort x %u
# Image format.
>0x08 byte 0 \b, ARGB1555
>0x08 byte 1 \b, RGB565
@ -1427,17 +1542,10 @@
>0x09 byte 0x11 \b, small VQ & mipmap
>0x09 byte 0x12 \b, square twiddled & mipmap
# Sega PVR (Xbox) image header.
# Contains an embedded DirectDraw surface instead of PVR data.
0 name sega-pvr-xbox-dds-header
>16 lelong x %d x
>12 lelong x %d,
>84 string x %.4s
# Sega PVR image.
0 string PVRT
>0x10 string DDS\040\174\000\000\000 Sega PVR (Xbox) image:
>>0x20 use sega-pvr-xbox-dds-header
>>0x20 use ms-directdraw-surface
>0x10 belong !0x44445320 Sega PVR image:
>>0 use sega-pvr-image-header
@ -1445,15 +1553,15 @@
0 string GBIX
>0x10 string PVRT
>>0x10 string DDS\040\174\000\000\000 Sega PVR (Xbox) image:
>>>0x20 use sega-pvr-xbox-dds-header
>>0x20 use ms-directdraw-surface
>>0x10 belong !0x44445320 Sega PVR image:
>>>0x10 use sega-pvr-image-header
>>0x08 lelong x \b, global index = %u
# Sega GVR header.
0 name sega-gvr-image-header
>0x0C beshort x %d x
>0x0E beshort x %d
>0x0C beshort x %u x
>0x0E beshort x %u
# Image data format.
>0x0B byte 0 \b, I4
>0x0B byte 1 \b, I8
@ -1476,6 +1584,12 @@
>>0x10 use sega-gvr-image-header
>>0x08 belong x \b, global index = %u
# Sega GVR image with GCIX. (Wii)
0 string GCIX
>0x10 string GVRT Sega GVR image:
>>0x10 use sega-gvr-image-header
>>0x08 belong x \b, global index = %u
# Light Field Picture
# Documentation: http://optics.miloush.net/lytro/TheFileFormat.aspx
# Typical file extensions: .lfp .lfr .lfx
@ -1511,3 +1625,171 @@
>12 lelong x version %d,
>20 lelong x %dx
>24 lelong x \b%d
# Type: Khronos KTX texture.
# From: David Korth <gerbilsoft@gerbilsoft.com>
# References:
# - https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
# glEnum decoding.
# NOTE: Only the most common formats are listed here.
0 name khronos-ktx-glEnum
>0 lelong 0x1907 \b, RGB
>0 lelong 0x1908 \b, RGBA
>0 lelong 0x1909 \b, LUMINANCE
>0 lelong 0x190A \b, LUMINANCE_ALPHA
>0 lelong 0x80E1 \b, BGR
>0 lelong 0x80E2 \b, BGRA
>0 lelong 0x83A0 \b, RGB_S3TC
>0 lelong 0x83A1 \b, RGB4_S3TC
>0 lelong 0x83A2 \b, RGBA_S3TC
>0 lelong 0x83A3 \b, RGBA4_S3TC
>0 lelong 0x83A4 \b, RGBA_DXT5_S3TC
>0 lelong 0x83A5 \b, RGBA4_DXT5_S3TC
>0 lelong 0x8D64 \b, ETC1_RGB8_OES
>0 lelong 0x9270 \b, COMPRESSED_R11_EAC
>0 lelong 0x9271 \b, COMPRESSED_SIGNED_R11_EAC
>0 lelong 0x9272 \b, COMPRESSED_RG11_EAC
>0 lelong 0x9273 \b, COMPRESSED_SIGNED_RG11_EAC
>0 lelong 0x9274 \b, COMPRESSED_RGB8_ETC2
>0 lelong 0x9275 \b, COMPRESSED_SRGB8_ETC2
>0 lelong 0x9276 \b, COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
>0 lelong 0x9277 \b, COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
>0 lelong 0x9278 \b, COMPRESSED_RGBA2_ETC2_EAC
>0 lelong 0x9279 \b, COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
>0 lelong 0x93B0 \b, COMPRESSED_RGBA_ASTC_4x4_KHR
>0 lelong 0x93B1 \b, COMPRESSED_RGBA_ASTC_5x4_KHR
>0 lelong 0x93B2 \b, COMPRESSED_RGBA_ASTC_5x5_KHR
>0 lelong 0x93B3 \b, COMPRESSED_RGBA_ASTC_6x5_KHR
>0 lelong 0x93B4 \b, COMPRESSED_RGBA_ASTC_6x6_KHR
>0 lelong 0x93B5 \b, COMPRESSED_RGBA_ASTC_8x5_KHR
>0 lelong 0x93B6 \b, COMPRESSED_RGBA_ASTC_8x6_KHR
>0 lelong 0x93B7 \b, COMPRESSED_RGBA_ASTC_8x8_KHR
>0 lelong 0x93B8 \b, COMPRESSED_RGBA_ASTC_10x5_KHR
>0 lelong 0x93B9 \b, COMPRESSED_RGBA_ASTC_10x6_KHR
>0 lelong 0x93BA \b, COMPRESSED_RGBA_ASTC_10x8_KHR
>0 lelong 0x93BB \b, COMPRESSED_RGBA_ASTC_10x10_KHR
>0 lelong 0x93BC \b, COMPRESSED_RGBA_ASTC_12x10_KHR
>0 lelong 0x93BD \b, COMPRESSED_RGBA_ASTC_12x12_KHR
>0 lelong 0x93D0 \b, COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
>0 lelong 0x93D1 \b, COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
>0 lelong 0x93D2 \b, COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
>0 lelong 0x93D3 \b, COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
>0 lelong 0x93D4 \b, COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
>0 lelong 0x93D5 \b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
>0 lelong 0x93D6 \b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
>0 lelong 0x93D7 \b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
>0 lelong 0x93D8 \b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
>0 lelong 0x93D9 \b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
>0 lelong 0x93DA \b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
>0 lelong 0x93DB \b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
>0 lelong 0x93DC \b, COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
>0 lelong 0x93DD \b, COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
# Endian-specific KTX header.
# TODO: glType (all textures I've seen so far are GL_UNSIGNED_BYTE)
0 name khronos-ktx-endian-header
>20 lelong x \b, %u
>24 lelong >1 x %u
>28 lelong >1 x %u
>8 lelong >0
>>8 use khronos-ktx-glEnum
>8 lelong 0
>>12 use khronos-ktx-glEnum
# Main KTX header.
# Determine endianness, then check the rest of the header.
0 string \xABKTX\ 11\xBB\r\n\x1A\n Khronos KTX texture
>12 lelong 0x04030201 (little-endian)
>>16 use khronos-ktx-endian-header
>12 belong 0x04030201 (big-endian)
>>16 use ^khronos-ktx-endian-header
# Type: Valve VTF texture.
# From: David Korth <gerbilsoft@gerbilsoft.com>
# References:
# - https://developer.valvesoftware.com/wiki/Valve_Texture_Format
# VTF image formats.
0 name vtf-image-format
>0 lelong 0 RGBA8888
>0 lelong 1 ABGR8888
>0 lelong 2 RGB888
>0 lelong 3 BGR888
>0 lelong 4 RGB565
>0 lelong 5 I8
>0 lelong 6 IA88
>0 lelong 7 P8
>0 lelong 8 A8
>0 lelong 9 RGB888 (bluescreen)
>0 lelong 10 BGR888 (bluescreen)
>0 lelong 11 ARGB8888
>0 lelong 12 BGRA8888
>0 lelong 13 DXT1
>0 lelong 14 DXT3
>0 lelong 15 DXT5
>0 lelong 16 BGRx8888
>0 lelong 17 BGR565
>0 lelong 18 BGRx5551
>0 lelong 19 BGRA4444
>0 lelong 20 DXT1+A1
>0 lelong 21 BGRA5551
>0 lelong 22 UV88
>0 lelong 23 UVWQ8888
>0 lelong 24 RGBA16161616F
>0 lelong 25 RGBA16161616
>0 lelong 26 UVLX8888
# Main VTF header.
0 string VTF\0 Valve Texture Format
>4 lelong x v%u
>8 lelong x \b.%u
>0x10 leshort x \b, %u
>0x12 leshort >1 x %u
>4 lequad 0x0000000700000002
>>0x3F leshort >1 x %u
>0x18 leshort >1 \b, %u frames
>0x38 byte x \b, mipmaps: %u
>0x34 lelong >-1 \b,
>>0x34 use vtf-image-format
# Type: Valve VTF3 (PS3) texture.
# From: David Korth <gerbilsoft@gerbilsoft.com>
0 string VTF3 Valve Texture Format (PS3)
>0x14 beshort x \b, %u
>0x16 beshort x \b x %u
>0x10 belong&0x2000 0 \b, DXT1
>0x10 belong&0x2000 0x2000 \b, DXT5
# Type: ASTC texture.
# From: David Korth <gerbilsoft@gerbilsoft.com>
# References:
# - https://stackoverflow.com/questions/22600678/determine-internal-format-of-given-astc-compressed-image-through-its-header
# - https://stackoverflow.com/a/22682244
0 lelong 0x5ca1ab13 ASTC
>4 byte x %u
>5 byte x \bx%u
>6 byte >1 \bx%u
# X, Y, and Z dimensions are stored as 24-bit LE.
# Pretend it's 32-bit and mask off the high byte.
>7 lelong&0x00FFFFFF x texture, %u
>10 lelong&0x00FFFFFF x x %u
>13 lelong&0x00FFFFFF >1 x %u
# Zebra Metafile graphic
# http://www.fileformat.info/format/zbr/egff.htm
0 beshort 0x9a02 Zebra Metafile graphic
>2 leshort 1 (version 1.x)
>2 leshort 2 (version 1.1x or 1.2x)
>2 leshort 3 (version 1.49)
>2 leshort 4 (version 1.50)
>4 string x (comment = %s)
# Microsoft Paint graphic
# http://www.fileformat.info/format/mspaint/egff.htm
0 string DanM icrosoft Paint image data (version 1.x)
>4 leshort x (%d
>>6 leshort x x %d)
0 string LinS Microsoft Paint image data (version 2.0)
>4 leshort x (%d
>>6 leshort x x %d)

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: linux,v 1.64 2017/03/17 21:35:28 christos Exp $
# $File: linux,v 1.65 2018/07/16 12:32:08 christos Exp $
# linux: file(1) magic for Linux files
#
# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
@ -94,6 +94,16 @@
# From Daniel Novotny <dnovotny@redhat.com>
# swap file for PowerPC
65526 string SWAPSPACE2 Linux/ppc swap file
>0x400 long x version %d,
>0x404 long x size %d pages,
>1052 string \0 no label,
>1052 string >\0 LABEL=%s,
>0x40c belong x UUID=%08x
>0x410 beshort x \b-%04x
>0x412 beshort x \b-%04x
>0x414 beshort x \b-%04x
>0x416 belong x \b-%08x
>0x41a beshort x \b%04x
16374 string SWAPSPACE2 Linux/ia64 swap file
#
# Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu>

View File

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# $File: make,v 1.3 2016/12/10 14:21:29 christos Exp $
# $File: make,v 1.4 2018/05/29 17:26:02 christos Exp $
# make: file(1) magic for makefiles
#
# URL: https://en.wikipedia.org/wiki/Make_(software)
@ -17,13 +17,20 @@
# Reference: https://www.freebsd.org/cgi/man.cgi?make(1)
# exclude grub-core\lib\libgcrypt\mpi\Makefile.am with "#BEGIN_ASM_LIST"
# by additional escaping point character
0 regex/100l \^\\.BEGIN BSD makefile script text with "%s"
0 regex/100l \^\\.BEGIN BSD makefile script text
!:mime text/x-makefile
!:ext /mk
!:strength +10
# exclude MS Windows help file CoNtenT with ":include FOOBAR.CNT"
# and NSIS script with "!include" by additional escaping point character
0 regex/100l \^\\.include BSD makefile script text with "%s"
0 regex/100l \^\\.include BSD makefile script text
!:mime text/x-makefile
!:ext /mk
!:strength +10
0 regex/100l \^\\.endif BSD makefile script text
!:mime text/x-makefile
!:ext /mk
!:strength +10
0 regex/100l \^SUBDIRS automake makefile script text
!:mime text/x-makefile
!:strength +10

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: measure,v 1.1 2017/11/28 14:01:14 christos Exp $
# $File: measure,v 1.2 2018/06/23 16:13:15 christos Exp $
# measure: file(1) magic for measurement data
# DIY-Thermocam raw data
@ -8,31 +8,31 @@
>0 beshort x scale %d-
>2 beshort x \b%d,
>4 lefloat x spot sensor temperature %f,
>9 byte 0 unit celsius,
>9 byte 1 unit fahrenheit,
>8 byte x color scheme %d
>10 byte 1 \b, show spot sensor
>11 byte 1 \b, show scale bar
>12 byte &1 \b, minimum point enabled
>12 byte &2 \b, maximum point enabled
>9 ubyte 0 unit celsius,
>9 ubyte 1 unit fahrenheit,
>8 ubyte x color scheme %d
>10 ubyte 1 \b, show spot sensor
>11 ubyte 1 \b, show scale bar
>12 ubyte &1 \b, minimum point enabled
>12 ubyte &2 \b, maximum point enabled
>13 lefloat x \b, calibration: offset %f,
>17 lefloat x slope %f
0 name diy-thermocam-checker
>9 byte <2
>>10 byte <2
>>>11 byte <2
>>>>12 byte <4
>9 ubyte <2
>>10 ubyte <2
>>>11 ubyte <2
>>>>12 ubyte <4
>>>>>17 lefloat >0.0001 DIY-Thermocam raw data
# V2 and Leption 3.x:
38408 byte <19
38408 ubyte <19
>38400 use diy-thermocam-checker
>>38400 default x (Lepton 3.x),
>>>38400 use diy-thermocam-parser
# V1 or Lepton 2.x
9608 byte <19
9608 ubyte <19
>9600 use diy-thermocam-checker
>>9600 default x (Lepton 2.x),
>>>9600 use diy-thermocam-parser

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: msdos,v 1.121 2017/10/27 21:43:23 christos Exp $
# $File: msdos,v 1.124 2018/07/10 04:05:50 christos Exp $
# msdos: file(1) magic for MS-DOS files
#
@ -792,10 +792,16 @@
#0 string Nullsoft\ AVS\ Preset\ \060\056\061\032 A plug in for Winamp ms-windows Freeware media player
0 string/b Nullsoft\ AVS\ Preset\ Winamp plug in
# Windows Metafont .WMF
0 string/b \327\315\306\232 ms-windows metafont .wmf
0 string/b \002\000\011\000 ms-windows metafont .wmf
0 string/b \001\000\011\000 ms-windows metafont .wmf
# Windows Metafile .WMF
0 string/b \327\315\306\232 Windows metafile
!:mime image/wmf
!:ext wmf
0 string/b \002\000\011\000 Windows metafile
!:mime image/wmf
!:ext wmf
0 string/b \001\000\011\000 Windows metafile
!:mime image/wmf
!:ext wmf
#tz3 files whatever that is (MS Works files)
0 string/b \003\001\001\004\070\001\000\000 tz3 ms-works file
@ -1032,12 +1038,246 @@
#------------------------------------------------------------------------------
# From Stuart Caie <kyzer@4u.net> (developer of cabextract)
# Update: Joerg Jenderek
# URL: https://en.wikipedia.org/wiki/Cabinet_(file_format)
# Reference: https://msdn.microsoft.com/en-us/library/bb267310.aspx
# Note: verified by `7z l *.cab`
# Microsoft Cabinet files
0 string/b MSCF\0\0\0\0 Microsoft Cabinet archive data
!:mime application/vnd.ms-cab-compressed
>8 lelong x \b, %u bytes
>28 leshort 1 \b, 1 file
>28 leshort >1 \b, %u files
#
# https://support.microsoft.com/en-us/help/973559/frequently-asked-questions-about-the-microsoft-support-diagnostic-tool
# CAB with *.{diagcfg,diagpkg} is used by Microsoft Support Diagnostic Tool MSDT.EXE
# because some archive does not have *.diag* as 1st or 2nd archive member like
# O15CTRRemove.diagcab or AzureStorageAnalyticsLogs_global.DiagCab
# brute looking after header for filenames with diagcfg or diagpkg extension in CFFILE section
>0x2c search/980/c .diag \b, Diagnostic
!:mime application/vnd.ms-cab-compressed
!:ext diagcab
# http://fileformats.archiveteam.org/wiki/PUZ
# Microsoft Publisher version about 2003 has a "Pack and Go" feature that
# bundles a Publisher document *PNG.pub with all links into a CAB
>0x2c search/300/c png.pub\0 \b, Publisher Packed and Go
!:mime application/vnd.ms-cab-compressed
!:ext puz
# ppz variant with Microsoft PowerPoint Viewer ppview32.exe to play PowerPoint presentation
>0x2c search/17/c ppview32.exe\0 \b, PowerPoint Viewer Packed and Go
!:mime application/vnd.ms-powerpoint
#!:mime application/mspowerpoint
!:ext ppz
# http://www.incredimail.com/
# IncrediMail CAB contains an initialisation file "content.ini" like in im2.ims
>0x2c search/3369/c content.ini\0 \b, IncrediMail
!:mime application/x-incredimail
# member Flavor.htm implies IncrediMail ecard like in tell_a_friend.imf
>>0x2c search/83/c Flavor.htm\0 ecard
!:ext imf
# member Macromedia Flash data *.swf implies IncrediMail skin like in im2.ims
>>0x2c search/211/c .swf\0 skin
!:ext ims
# member anim.im3 implies IncrediMail animation like in letter_fold.ima
>>0x2c search/92/c anim.im3\0 animation
!:ext ima
# other IncrediMail cab archive
>>0x2c default x
>>>0x2c search/116/c thumb ecard, image, notifier or skin
!:ext imf/imi/imn/ims
# http://file-extension.net/seeker/file_extension_ime
>>>0x2c default x emoticons or sound
!:ext ime/imw
# no Diagnostic and IncrediMail
>0x2c default x
# look for 1st member name
>>(16.l+16) ubyte x
# https://en.wikipedia.org/wiki/SNP_file_format
>>>&-1 string/c _accrpt_.snp \b, Access report snapshot
!:mime application/msaccess
!:ext snp
# https://www.cabextract.org.uk/wince_cab_format/
# extension of DOS 8+3 name with ".000" of 1st archive member name implies Windows CE installer
>>>&7 string =.000 \b, WinCE install
!:mime application/vnd.ms-cab-compressed
!:ext cab
# http://support.microsoft.com/kb/934307/en-US
# All inspected MSU contain a file with name WSUSSCAN.cab
# that is called "Windows Update meta data" by Microsoft
>>>&-1 string/c wsusscan.cab \b, Microsoft Standalone Update
!:mime application/vnd.ms-cab-compressed
!:ext msu
>>>&-1 default x
# look at point charcter of 1st archive member name for file name extension
>>>>&-1 search/255 .
# http://www.pptfaq.com/FAQ00164_What_is_a_PPZ_file-.htm
# PPZ were created using Pack & Go feature of PowerPoint versions 97 - 2002
# packs optional files, a PowerPoint presentation *.ppt with optional PLAYLIST.LST to CAB
>>>>>&0 string/c ppt\0 \b, PowerPoint Packed and Go
!:mime application/vnd.ms-powerpoint
#!:mime application/mspowerpoint
!:ext ppz
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb773190(v=vs.85).aspx
# first member *.theme implies Windows 7 Theme Pack like in CommunityShowcaseAqua3.themepack
# or Windows 8 Desktop Theme Pack like in PanoramicGlaciers.deskthemepack
>>>>>&0 string/c theme \b, Windows
!:mime application/x-windows-themepack
# http://www.drewkeller.com/content/using-theme-both-windows-7-and-windows-8
# 1st member Panoramic.theme or Panoramas.theme implies Windows 8-10 Theme Pack
# with MTSM=RJSPBS in [MasterThemeSelector] inside *.theme
>>>>>>(16.l+16) string =Panoram 8
!:ext deskthemepack
>>>>>>(16.l+16) string !Panoram 7 or 8
!:ext themepack/deskthemepack
>>>>>>(16.l+16) ubyte x Theme Pack
>>>>>&0 default x
# look for null terminator of 1st member name
>>>>>>&0 search/255 \0
# 2nd member name WSUSSCAN.cab like in Microsoft-Windows-MediaFeaturePack-OOB-Package.msu
>>>>>>>&16 string/c wsusscan.cab \b, Microsoft Standalone Update
!:mime application/vnd.ms-cab-compressed
!:ext msu
>>>>>>>&16 default x
# archive with more then one file need some output in version 5.32 to avoid error message like
# Magdir/msdos, 1138: Warning: Current entry does not yet have a description for adding a MIME type
# Magdir/msdos, 1139: Warning: Current entry does not yet have a description for adding a EXTENSION type
# file: could not find any valid magic files!
>>>>>>>>28 uleshort >1 \b, many
!:mime application/vnd.ms-cab-compressed
!:ext cab
# remaining archives with just one file
>>>>>>>>28 uleshort =1
# neither extra bytes nor cab chain implies Windows 2000,XP setup files in directory i386
>>>>>>>>>30 uleshort =0x0000 \b, Windows 2000/XP setup
# cut of last char of source extension and add underscore to generate extension
# TERMCAP._ ... FXSCOUNT.H_ ... L3CODECA.AC_ ... NPDRMV2.ZI_
!:mime application/vnd.ms-cab-compressed
!:ext _/?_/??_
# archive need some output like "single" in version 5.32 to avoid error messages
>>>>>>>>>30 uleshort !0x0000 \b, single
!:mime application/vnd.ms-cab-compressed
!:ext cab
# TODO: additional extensions like
# .xsn InfoPath Dynamic Form
# .xtp InfoPath Template Part
# .lvf Logitech Video Effects Face Accessory
>8 ulelong x \b, %u bytes
>28 uleshort 1 \b, 1 file
>28 uleshort >1 \b, %u files
# Reserved fields, set to zero
#>4 belong !0 \b, reserved1 %x
#>12 belong !0 \b, reserved2 %x
# offset of the first CFFILE entry coffFiles: minimal 2Ch
>16 ulelong x \b, at 0x%x
>(16.l) use cab-file
# at least also 2nd member
>28 uleshort >1
>>(16.l+16) ubyte x
>>>&0 search/255 \0
# second member info
>>>>&0 use cab-file
#>20 belong !0 \b, reserved %x
# Cabinet file format version. Currently, versionMajor = 1 and versionMinor = 3
>24 ubeshort !0x0301 \b version 0x%x
# number of CFFOLDER entries
>26 uleshort >1 \b, %u cffolders
# cabinet file option indicators 1~PREVIOUS, 2~NEXT, 4~reserved fields
# only found for flags 0 1 2 3 4 not 7
>30 uleshort >0 \b, flags 0x%x
# Cabinet files have a 16-bit cabinet setID field that is designed for application use.
# default is zero, however, the -i option of cabarc can be used to set this field
>32 uleshort >0 \b, ID %u
# iCabinet is number of this cabinet file in a set, where 0 for the first cabinet
#>34 uleshort x \b, iCabinet %u
# add one for display because humans start numbering by 1 and also fit to name of disk szDisk*
>34 uleshort+1 x \b, number %u
>30 uleshort &0x0004 \b, extra bytes
# cbCFHeader optional size of per-cabinet reserved area 14h 1800h
>>36 uleshort >0 %u in head
# cbCFFolder is optional size of per-folder reserved area
>>38 ubyte >0 %u in folder
# cbCFData is optional size of per-datablock reserved area
>>39 ubyte >0 %u in data block
# optional per-cabinet reserved area abReserve[cbCFHeader]
>>36 uleshort >0
# 1st CFFOLDER after reserved area in header
>>>(36.s+40) use cab-folder
# no reserved area in header
>30 uleshort ^0x0004
# no previous and next cab archive
>>30 uleshort =0x0000
>>>36 use cab-folder
# only previous cab archive
>>30 uleshort =0x0001 \b, previous
>>>36 use cab-anchor
# only next cab archive
>>30 uleshort =0x0002 \b, next
>>>36 use cab-anchor
# previous+next cab archive
# can not use sub routine cab-anchor to display previous and next cabinet together
#>>>36 use cab-anchor
#>>>>&0 use cab-anchor
>>30 uleshort =0x0003 \b, previous
>>>36 string x %s
# optional name of previous disk szDisk*
>>>>&1 string x disk %s
>>>>>&1 string x \b, next %s
# optional name of previous disk szDisk*
>>>>>>&1 string x disk %s
>>>>>>>&1 use cab-folder
# display filename and disk name of previous or next cabinet
0 name cab-anchor
# optional name of previous/next cabinet file szCabinet*[255]
>&0 string x %s
# optional name of previous/next disk szDisk*[255]
>>&1 string x disk %s
# display folder structure CFFOLDER information like compression of cabinet
0 name cab-folder
# offset of the CFDATA block in this folder
#>0 ulelong x \b, coffCabStart 0x%x
# number of CFDATA blocks in folder
>4 uleshort x \b, %u datablock
# plural s
>4 uleshort >1 \bs
# compression typeCompress: 0~None 1~MSZIP 0x1503~LZX:21 0x1003~LZX:16 0x0f03~LZX:15
>6 uleshort x \b, 0x%x compression
# optional per-folder reserved area
#>8 ubequad x \b, abReserve 0x%llx
# display member structure CFFILE information like member name of cabinet
0 name cab-file
# cbFile is uncompressed size of file in bytes
#>0 ulelong x \b, cbFile %u
# uoffFolderStart is uncompressed offset of file in folder
#>4 ulelong >0 \b, uoffFolderStart 0x%x
# iFolder is index into the CFFOLDER area. 0 indicates first folder in cabinet
# define ifoldCONTINUED_FROM_PREV (0xFFFD)
# define ifoldCONTINUED_TO_NEXT (0xFFFE)
# define ifoldCONTINUED_PREV_AND_NEXT (0xFFFF)
>8 uleshort >0 \b, iFolder 0x%x
# date stamp for file
#>10 uleshort x \b, date 0x%x
# time stamp for file
#>12 uleshort x \b, time 0x%x
# attribs is attribute flags for file
# define _A_RDONLY (0x01) file is read-only
# define _A_HIDDEN (0x02) file is hidden
# define _A_SYSTEM (0x04) file is a system file
# define _A_ARCH (0x20) file modified since last backup
# example http://sebastien.kirche.free.fr/pebuilder_plugins/depends.cab
# define _A_EXEC (0x40) run after extraction
# define _A_NAME_IS_UTF (0x80) szName[] contains UTF
# define UNKNOWN (0x0100) undocumented or accident
#>14 uleshort x \b, attribs 0x%x
>14 uleshort >0 +
>>14 uleshort &0x0001 \bR
>>14 uleshort &0x0002 \bH
>>14 uleshort &0x0004 \bS
>>14 uleshort &0x0020 \bA
>>14 uleshort &0x0040 \bX
>>14 uleshort &0x0080 \bUtf
# unknown 0x0100 flag found on one XP_CD:\I386\DRIVER.CAB
>>14 uleshort &0x0100 \b?
# szName is name of archive member
>16 string x "%s"
# next archive member name if more files
#>>&17 string >\0 \b, NEXT NAME %-.50s
# InstallShield Cabinet files
0 string/b ISc( InstallShield Cabinet archive data
@ -1088,14 +1328,6 @@
>5 byte <2
>>48 string x version %.3s
# Type: Microsoft DirectDraw Surface
# URL: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
# From: Morten Hustveit <morten@debian.org>
0 string/b DDS\040\174\000\000\000 Microsoft DirectDraw Surface (DDS),
>16 lelong >0 %d x
>12 lelong >0 %d,
>84 string x %.4s
# Type: Microsoft Document Imaging Format (.mdi)
# URL: http://en.wikipedia.org/wiki/Microsoft_Document_Imaging_Format
# From: Daniele Sempione <scrows@oziosi.org>

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: msooxml,v 1.7 2018/03/12 12:38:59 christos Exp $
# $File: msooxml,v 1.8 2018/05/24 18:11:17 christos Exp $
# msooxml: file(1) magic for Microsoft Office XML
# From: Ralf Brown <ralf.brown@gmail.com>
@ -24,6 +24,7 @@
0 string PK\003\004
!:strength +10
# make sure the first file is correct
>0x1E use msooxml
>0x1E regex \\[Content_Types\\]\\.xml|_rels/\\.rels
# skip to the second local file header
# since some documents include a 520-byte extra field following the file

View File

@ -1,16 +1,18 @@
#------------------------------------------------------------------------------
# $File: pdf,v 1.9 2017/05/24 17:35:20 christos Exp $
# $File: pdf,v 1.10 2018/05/23 22:21:01 christos Exp $
# pdf: file(1) magic for Portable Document Format
#
0 string %PDF- PDF document
!:mime application/pdf
!:strength +60
>5 byte x \b, version %c
>7 byte x \b.%c
0 string \012%PDF- PDF document
!:mime application/pdf
!:strength +60
>6 byte x \b, version %c
>8 byte x \b.%c
@ -18,10 +20,12 @@
# Forms Data Format
0 string %FDF- FDF document
!:mime application/vnd.fdf
!:strength +60
>5 byte x \b, version %c
>7 byte x \b.%c
0 search/256 %PDF- PDF document
!:mime application/pdf
!:strength +60
>&0 byte x \b, version %c
>&2 byte x \b.%c

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
# $File: sgi,v 1.22 2015/08/29 07:10:35 christos Exp $
# $File: sgi,v 1.23 2018/05/29 02:26:56 christos Exp $
# sgi: file(1) magic for Silicon Graphics operating systems and applications
#
# Executable images are handled either in aout (for old-style a.out
@ -70,8 +70,6 @@
4 belong 0x00000010 GLS_BINARY_MSB_FIRST
!:strength -30
#
#
# Performance Co-Pilot file types
0 string PmNs PCP compiled namespace (V.0)
0 string PmN PCP compiled namespace
@ -114,6 +112,8 @@
>16 string >\0 (V.%1.1s)
3 string pmieconf-pmie PCP pmie config
>17 string >\0 (V.%1.1s)
0 string MMV PCP memory mapped values
>4 long x (V.%d)
# SpeedShop data files
0 lelong 0x13130303 SpeedShop data file

View File

@ -1,5 +1,5 @@
#
# $File: Makefile.am,v 1.132 2018/01/28 00:00:17 rrt Exp $
# $File: Makefile.am,v 1.133 2018/06/06 01:16:40 christos Exp $
#
MAGIC_FRAGMENT_BASE = Magdir
MAGIC_DIR = $(top_srcdir)/magic
@ -72,6 +72,7 @@ $(MAGIC_FRAGMENT_DIR)/cubemap \
$(MAGIC_FRAGMENT_DIR)/cups \
$(MAGIC_FRAGMENT_DIR)/dact \
$(MAGIC_FRAGMENT_DIR)/database \
$(MAGIC_FRAGMENT_DIR)/dataone \
$(MAGIC_FRAGMENT_DIR)/dbpf \
$(MAGIC_FRAGMENT_DIR)/der \
$(MAGIC_FRAGMENT_DIR)/diamond \

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.13.1 from Makefile.am.
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -15,23 +15,61 @@
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
test $$am__dry = yes; \
}
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
@ -50,7 +88,6 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = magic
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@ -58,6 +95,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@ -111,6 +149,7 @@ am__uninstall_files_from_dir = { \
am__installdirs = "$(DESTDIR)$(pkgdatadir)"
DATA = $(pkgdata_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgdatadir = @pkgdatadir@
ACLOCAL = @ACLOCAL@
@ -124,6 +163,7 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
@ -139,6 +179,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_VISIBILITY = @HAVE_VISIBILITY@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@ -232,7 +273,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
#
# $File: Makefile.am,v 1.132 2018/01/28 00:00:17 rrt Exp $
# $File: Makefile.am,v 1.133 2018/06/06 01:16:40 christos Exp $
#
MAGIC_FRAGMENT_BASE = Magdir
MAGIC_DIR = $(top_srcdir)/magic
@ -303,6 +344,7 @@ $(MAGIC_FRAGMENT_DIR)/cubemap \
$(MAGIC_FRAGMENT_DIR)/cups \
$(MAGIC_FRAGMENT_DIR)/dact \
$(MAGIC_FRAGMENT_DIR)/database \
$(MAGIC_FRAGMENT_DIR)/dataone \
$(MAGIC_FRAGMENT_DIR)/dbpf \
$(MAGIC_FRAGMENT_DIR)/der \
$(MAGIC_FRAGMENT_DIR)/diamond \
@ -556,7 +598,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign magic/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign magic/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@ -756,6 +797,8 @@ uninstall-am: uninstall-pkgdataDATA
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags-am uninstall uninstall-am uninstall-pkgdataDATA
.PRECIOUS: Makefile
${MAGIC}: $(EXTRA_DIST) $(FILE_COMPILE_DEP)
@rm -fr magic

View File

@ -1,9 +1,9 @@
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2012-06-26.16; # UTC
scriptversion=2013-10-28.13; # UTC
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
@ -160,7 +160,7 @@ give_advice ()
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'automa4te' program to be rebuilt."
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)

View File

@ -0,0 +1,16 @@
# Python `file-magic` Log of Changes
## `0.4.0`
- Sync with current version of file:
* Retain python 2 compatibility, factoring out the conversion functions.
* Avoid double encoding with python3
* Restore python-2 compatibility.
## `0.3.0`
- Fix `setup.py` so we can upload to PyPI
- Add function `detect_from_filename`
- Add function `detect_from_fobj`
- Add function `detect_from_content`

View File

@ -0,0 +1,25 @@
Copyright (c) Ian F. Darwin 1986-1995.
Software written by Ian F. Darwin and others;
maintained 1995-present by Christos Zoulas and others.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice immediately at the beginning of the file, without modification,
this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

View File

@ -1,3 +1,4 @@
EXTRA_DIST = README example.py magic.py setup.py
EXTRA_DIST = LICENSE CHANGELOG.md README.md example.py magic.py setup.py \
tests.py

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.13.1 from Makefile.am.
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -14,23 +14,61 @@
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
test $$am__dry = yes; \
}
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
@ -49,7 +87,6 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = python
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@ -57,6 +94,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@ -81,6 +119,7 @@ am__can_run_installinfo = \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgdatadir = @pkgdatadir@
ACLOCAL = @ACLOCAL@
@ -94,6 +133,7 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
@ -109,6 +149,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_VISIBILITY = @HAVE_VISIBILITY@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@ -200,7 +241,9 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = README example.py magic.py setup.py
EXTRA_DIST = LICENSE CHANGELOG.md README.md example.py magic.py setup.py \
tests.py
all: all-am
.SUFFIXES:
@ -216,7 +259,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign python/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign python/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@ -391,6 +433,8 @@ uninstall-am:
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -0,0 +1,31 @@
# `file-magic`: Python Bindings
This library is a Python ctypes interface to `libmagic`.
## Installing
You can install `file-magic` either with:
python setup.py install
# or
easy_install .
# or
pip install file-magic
## Using
import magic
detected = magic.detect_from_filename('magic.py')
print 'Detected MIME type: {}'.format(detected.mime_type)
print 'Detected encoding: {}'.format(detected.encoding)
print 'Detected file type name: {}'.format(detected.name)
## Developing/Contributing
To run the tests:
python setup.py test

View File

@ -248,7 +248,10 @@ def open(flags):
def _create_filemagic(mime_detected, type_detected):
mime_type, mime_encoding = mime_detected.split('; ')
try:
mime_type, mime_encoding = mime_detected.split('; ')
except ValueError:
raise ValueError(mime_detected)
return FileMagic(name=type_detected, mime_type=mime_type,
encoding=mime_encoding.replace('charset=', ''))

View File

@ -4,14 +4,19 @@
from setuptools import setup
with open('README.md', 'r') as fh:
long_description = fh.read()
setup(name='file-magic',
version='0.3.0',
version='0.4.0',
author='Reuben Thomas, Álvaro Justen',
author_email='rrt@sc3d.org, alvarojusten@gmail.com',
url='https://github.com/file/file',
license='BSD',
description='(official) libmagic Python bindings',
long_description=long_description,
long_description_content_type='text/markdown',
py_modules=['magic'],
test_suite='tests',
classifiers = [

View File

@ -0,0 +1,32 @@
# coding: utf-8
import unittest
import magic
class MagicTestCase(unittest.TestCase):
filename = 'magic.py'
expected_mime_type = 'text/x-python'
expected_encoding = 'us-ascii'
expected_name = 'Python script, ASCII text executable'
def assert_result(self, result):
self.assertEqual(result.mime_type, self.expected_mime_type)
self.assertEqual(result.encoding, self.expected_encoding)
self.assertEqual(result.name, self.expected_name)
def test_detect_from_filename(self):
result = magic.detect_from_filename(self.filename)
self.assert_result(result)
def test_detect_from_fobj(self):
with open(self.filename) as fobj:
result = magic.detect_from_fobj(fobj)
self.assert_result(result)
def test_detect_from_content(self):
with open(self.filename) as fobj:
result = magic.detect_from_content(fobj.read(4096))
self.assert_result(result)

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.13.1 from Makefile.am.
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -17,23 +17,61 @@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
test $$am__dry = yes; \
}
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
@ -53,10 +91,6 @@ build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = file$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am asprintf.c \
getopt_long.c localtime_r.c ctime_r.c getline.c pread.c \
strcasestr.c dprintf.c fmtcheck.c strlcpy.c asctime_r.c \
gmtime_r.c strlcat.c vasprintf.c $(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@ -64,6 +98,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@ -177,6 +212,10 @@ am__define_uniq_tagged_files = \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
asctime_r.c asprintf.c ctime_r.c dprintf.c fmtcheck.c \
getline.c getopt_long.c gmtime_r.c localtime_r.c pread.c \
strcasestr.c strlcat.c strlcpy.c vasprintf.c
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgdatadir = @pkgdatadir@
ACLOCAL = @ACLOCAL@
@ -190,6 +229,7 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
@ -205,6 +245,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_VISIBILITY = @HAVE_VISIBILITY@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@ -333,7 +374,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@ -386,6 +426,7 @@ clean-libLTLIBRARIES:
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libmagic.la: $(libmagic_la_OBJECTS) $(libmagic_la_DEPENDENCIES) $(EXTRA_libmagic_la_DEPENDENCIES)
$(AM_V_CCLD)$(libmagic_la_LINK) -rpath $(libdir) $(libmagic_la_OBJECTS) $(libmagic_la_LIBADD) $(LIBS)
install-binPROGRAMS: $(bin_PROGRAMS)
@ -437,6 +478,7 @@ clean-binPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES) $(EXTRA_file_DEPENDENCIES)
@rm -f file$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(file_OBJECTS) $(file_LDADD) $(LIBS)
@ -748,6 +790,8 @@ uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
uninstall-libLTLIBRARIES uninstall-nodist_includeHEADERS
.PRECIOUS: Makefile
magic.h: ${HDR}
sed -e "s/X.YY/$$(echo @VERSION@ | tr -d .)/" < ${HDR} > $@

View File

@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: apprentice.c,v 1.270 2018/02/21 21:26:48 christos Exp $")
FILE_RCSID("@(#)$File: apprentice.c,v 1.272 2018/06/22 20:39:50 christos Exp $")
#endif /* lint */
#include "magic.h"
@ -1980,6 +1980,12 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
case 'I':
m->in_type = FILE_BEID3;
break;
case 'q':
m->in_type = FILE_LEQUAD;
break;
case 'Q':
m->in_type = FILE_BEQUAD;
break;
default:
if (ms->flags & MAGIC_CHECK)
file_magwarn(ms,
@ -3335,7 +3341,7 @@ private void
bs1(struct magic *m)
{
m->cont_level = swap2(m->cont_level);
m->offset = swap4((int32_t)m->offset);
m->offset = swap4((uint32_t)m->offset);
m->in_offset = swap4((uint32_t)m->in_offset);
m->lineno = swap4((uint32_t)m->lineno);
if (IS_STRING(m->type)) {

View File

@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: compress.c,v 1.106 2017/11/02 20:25:39 christos Exp $")
FILE_RCSID("@(#)$File: compress.c,v 1.107 2018/04/28 18:48:22 christos Exp $")
#endif
#include "magic.h"
@ -183,6 +183,23 @@ static int makeerror(unsigned char **, size_t *, const char *, ...)
__attribute__((__format__(__printf__, 3, 4)));
private const char *methodname(size_t);
private int
format_decompression_error(struct magic_set *ms, size_t i, unsigned char *buf)
{
unsigned char *p;
int mime = ms->flags & MAGIC_MIME;
if (!mime)
return file_printf(ms, "ERROR:[%s: %s]", methodname(i), buf);
for (p = buf; *p; p++)
if (!isalnum(*p))
*p = '-';
return file_printf(ms, "application/x-decompression-error-%s-%s",
methodname(i), buf);
}
protected int
file_zmagic(struct magic_set *ms, const struct buffer *b, const char *name)
{
@ -226,11 +243,9 @@ file_zmagic(struct magic_set *ms, const struct buffer *b, const char *name)
switch (urv) {
case OKDATA:
case ERRDATA:
ms->flags &= ~MAGIC_COMPRESS;
if (urv == ERRDATA)
prv = file_printf(ms, "%s ERROR: %s",
methodname(i), newbuf);
prv = format_decompression_error(ms, i, newbuf);
else
prv = file_buffer(ms, -1, name, newbuf, nsz);
if (prv == -1)

View File

@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: der.c,v 1.12 2017/02/10 18:14:01 christos Exp $")
FILE_RCSID("@(#)$File: der.c,v 1.13 2018/06/23 15:15:26 christos Exp $")
#endif
#endif
@ -199,7 +199,7 @@ getlength(const uint8_t *c, size_t *p, size_t l)
for (i = 0; i < digits; i++)
len = (len << 8) | c[(*p)++];
if (*p + len >= l)
if (len > UINT32_MAX - *p || *p + len >= l)
return DER_BAD;
return CAST(uint32_t, len);
}

View File

@ -27,7 +27,7 @@
*/
/*
* file.h - definitions for file(1) program
* @(#)$File: file.h,v 1.191 2018/02/21 21:26:00 christos Exp $
* @(#)$File: file.h,v 1.193 2018/05/24 18:09:17 christos Exp $
*/
#ifndef __file_h__
@ -413,6 +413,7 @@ struct magic_set {
#define EVENT_HAD_ERR 0x01
const char *file;
size_t line; /* current magic line number */
mode_t mode; /* copy of current stat mode */
/* data for searches */
struct {
@ -618,9 +619,9 @@ int enable_sandbox_full(void);
protected const char *file_getprogname(void);
protected void file_setprogname(const char *);
protected void file_err(int, const char *, ...)
__attribute__((__format__(__printf__, 2, 3)));
__attribute__((__format__(__printf__, 2, 3), __noreturn__));
protected void file_errx(int, const char *, ...)
__attribute__((__format__(__printf__, 2, 3)));
__attribute__((__format__(__printf__, 2, 3), __noreturn__));
protected void file_warn(const char *, ...)
__attribute__((__format__(__printf__, 1, 2)));
protected void file_warnx(const char *, ...)

View File

@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: funcs.c,v 1.94 2017/11/02 20:25:39 christos Exp $")
FILE_RCSID("@(#)$File: funcs.c,v 1.95 2018/05/24 18:09:17 christos Exp $")
#endif /* lint */
#include "magic.h"
@ -183,9 +183,11 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
const char *type = "application/octet-stream";
const char *def = "data";
const char *ftype = NULL;
char *rbuf = NULL;
struct buffer b;
buffer_init(&b, fd, buf, nb);
ms->mode = b.st.st_mode;
if (nb == 0) {
def = "empty";
@ -248,31 +250,43 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
goto done;
}
}
#ifdef BUILTIN_ELF
if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && nb > 5 && fd != -1) {
file_pushbuf_t *pb;
/*
* We matched something in the file, so this
* *might* be an ELF file, and the file is at
* least 5 bytes long, so if it's an ELF file
* it has at least one byte past the ELF magic
* number - try extracting information from the
* ELF headers that cannot easily be extracted
* with rules in the magic file. We we don't
* print the information yet.
*/
if ((pb = file_push_buffer(ms)) == NULL)
return -1;
rv = file_tryelf(ms, &b);
rbuf = file_pop_buffer(ms, pb);
if (rv != 1) {
free(rbuf);
rbuf = NULL;
}
if ((ms->flags & MAGIC_DEBUG) != 0)
(void)fprintf(stderr, "[try elf %d]\n", m);
}
#endif
/* try soft magic tests */
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
m = file_softmagic(ms, &b, NULL, NULL, BINTEST, looks_text);
if ((ms->flags & MAGIC_DEBUG) != 0)
(void)fprintf(stderr, "[try softmagic %d]\n", m);
if (m == 1 && rbuf) {
if (file_printf(ms, "%s", rbuf) == -1)
goto done;
}
if (m) {
#ifdef BUILTIN_ELF
if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && m == 1 &&
nb > 5 && fd != -1) {
/*
* We matched something in the file, so this
* *might* be an ELF file, and the file is at
* least 5 bytes long, so if it's an ELF file
* it has at least one byte past the ELF magic
* number - try extracting information from the
* ELF headers that cannot easily * be
* extracted with rules in the magic file.
*/
m = file_tryelf(ms, &b);
if ((ms->flags & MAGIC_DEBUG) != 0)
(void)fprintf(stderr, "[try elf %d]\n",
m);
}
#endif
if (checkdone(ms, &rv))
goto done;
}
@ -318,6 +332,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
#if HAVE_FORK
done_encoding:
#endif
free(rbuf);
buffer_fini(&b);
if (rv)
return rv;

View File

@ -26,7 +26,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: readcdf.c,v 1.66 2017/11/02 20:25:39 christos Exp $")
FILE_RCSID("@(#)$File: readcdf.c,v 1.67 2018/04/15 19:57:07 christos Exp $")
#endif
#include <assert.h>
@ -147,118 +147,118 @@ private int
cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
size_t count, const cdf_directory_t *root_storage)
{
size_t i;
cdf_timestamp_t tp;
struct timespec ts;
char buf[64];
const char *str = NULL;
const char *s, *e;
int len;
size_t i;
cdf_timestamp_t tp;
struct timespec ts;
char buf[64];
const char *str = NULL;
const char *s, *e;
int len;
if (!NOTMIME(ms) && root_storage)
if (!NOTMIME(ms) && root_storage)
str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
clsid2mime);
for (i = 0; i < count; i++) {
cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
switch (info[i].pi_type) {
case CDF_NULL:
break;
case CDF_SIGNED16:
if (NOTMIME(ms) && file_printf(ms, ", %s: %hd", buf,
info[i].pi_s16) == -1)
return -1;
break;
case CDF_SIGNED32:
if (NOTMIME(ms) && file_printf(ms, ", %s: %d", buf,
info[i].pi_s32) == -1)
return -1;
break;
case CDF_UNSIGNED32:
if (NOTMIME(ms) && file_printf(ms, ", %s: %u", buf,
info[i].pi_u32) == -1)
return -1;
break;
case CDF_FLOAT:
if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
info[i].pi_f) == -1)
return -1;
break;
case CDF_DOUBLE:
if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
info[i].pi_d) == -1)
return -1;
break;
case CDF_LENGTH32_STRING:
case CDF_LENGTH32_WSTRING:
len = info[i].pi_str.s_len;
if (len > 1) {
char vbuf[1024];
size_t j, k = 1;
for (i = 0; i < count; i++) {
cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
switch (info[i].pi_type) {
case CDF_NULL:
break;
case CDF_SIGNED16:
if (NOTMIME(ms) && file_printf(ms, ", %s: %hd", buf,
info[i].pi_s16) == -1)
return -1;
break;
case CDF_SIGNED32:
if (NOTMIME(ms) && file_printf(ms, ", %s: %d", buf,
info[i].pi_s32) == -1)
return -1;
break;
case CDF_UNSIGNED32:
if (NOTMIME(ms) && file_printf(ms, ", %s: %u", buf,
info[i].pi_u32) == -1)
return -1;
break;
case CDF_FLOAT:
if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
info[i].pi_f) == -1)
return -1;
break;
case CDF_DOUBLE:
if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
info[i].pi_d) == -1)
return -1;
break;
case CDF_LENGTH32_STRING:
case CDF_LENGTH32_WSTRING:
len = info[i].pi_str.s_len;
if (len > 1) {
char vbuf[1024];
size_t j, k = 1;
if (info[i].pi_type == CDF_LENGTH32_WSTRING)
k++;
s = info[i].pi_str.s_buf;
if (info[i].pi_type == CDF_LENGTH32_WSTRING)
k++;
s = info[i].pi_str.s_buf;
e = info[i].pi_str.s_buf + len;
for (j = 0; s < e && j < sizeof(vbuf)
for (j = 0; s < e && j < sizeof(vbuf)
&& len--; s += k) {
if (*s == '\0')
break;
if (isprint((unsigned char)*s))
vbuf[j++] = *s;
}
if (j == sizeof(vbuf))
--j;
vbuf[j] = '\0';
if (NOTMIME(ms)) {
if (vbuf[0]) {
if (file_printf(ms, ", %s: %s",
buf, vbuf) == -1)
return -1;
}
} else if (str == NULL && info[i].pi_id ==
if (*s == '\0')
break;
if (isprint((unsigned char)*s))
vbuf[j++] = *s;
}
if (j == sizeof(vbuf))
--j;
vbuf[j] = '\0';
if (NOTMIME(ms)) {
if (vbuf[0]) {
if (file_printf(ms, ", %s: %s",
buf, vbuf) == -1)
return -1;
}
} else if (str == NULL && info[i].pi_id ==
CDF_PROPERTY_NAME_OF_APPLICATION) {
str = cdf_app_to_mime(vbuf, app2mime);
}
}
break;
case CDF_FILETIME:
tp = info[i].pi_tp;
if (tp != 0) {
break;
case CDF_FILETIME:
tp = info[i].pi_tp;
if (tp != 0) {
char tbuf[64];
if (tp < 1000000000000000LL) {
cdf_print_elapsed_time(tbuf,
sizeof(tbuf), tp);
if (NOTMIME(ms) && file_printf(ms,
", %s: %s", buf, tbuf) == -1)
return -1;
} else {
char *c, *ec;
cdf_timestamp_to_timespec(&ts, tp);
c = cdf_ctime(&ts.tv_sec, tbuf);
if (c != NULL &&
if (tp < 1000000000000000LL) {
cdf_print_elapsed_time(tbuf,
sizeof(tbuf), tp);
if (NOTMIME(ms) && file_printf(ms,
", %s: %s", buf, tbuf) == -1)
return -1;
} else {
char *c, *ec;
cdf_timestamp_to_timespec(&ts, tp);
c = cdf_ctime(&ts.tv_sec, tbuf);
if (c != NULL &&
(ec = strchr(c, '\n')) != NULL)
*ec = '\0';
if (NOTMIME(ms) && file_printf(ms,
", %s: %s", buf, c) == -1)
return -1;
}
}
break;
case CDF_CLIPBOARD:
break;
default:
return -1;
}
}
if (!NOTMIME(ms)) {
if (NOTMIME(ms) && file_printf(ms,
", %s: %s", buf, c) == -1)
return -1;
}
}
break;
case CDF_CLIPBOARD:
break;
default:
return -1;
}
}
if (!NOTMIME(ms)) {
if (str == NULL)
return 0;
if (file_printf(ms, "application/%s", str) == -1)
return -1;
}
return 1;
if (file_printf(ms, "application/%s", str) == -1)
return -1;
}
return 1;
}
private int
@ -270,7 +270,7 @@ cdf_file_catalog(struct magic_set *ms, const cdf_header_t *h,
char buf[256];
cdf_catalog_entry_t *ce;
if (NOTMIME(ms)) {
if (NOTMIME(ms)) {
if (file_printf(ms, "Microsoft Thumbs.db [") == -1)
return -1;
if (cdf_unpack_catalog(h, sst, &cat) == -1)
@ -296,44 +296,44 @@ private int
cdf_file_summary_info(struct magic_set *ms, const cdf_header_t *h,
const cdf_stream_t *sst, const cdf_directory_t *root_storage)
{
cdf_summary_info_header_t si;
cdf_property_info_t *info;
size_t count;
int m;
cdf_summary_info_header_t si;
cdf_property_info_t *info;
size_t count;
int m;
if (cdf_unpack_summary_info(sst, h, &si, &info, &count) == -1)
return -1;
if (cdf_unpack_summary_info(sst, h, &si, &info, &count) == -1)
return -1;
if (NOTMIME(ms)) {
if (NOTMIME(ms)) {
const char *str;
if (file_printf(ms, "Composite Document File V2 Document")
if (file_printf(ms, "Composite Document File V2 Document")
== -1)
return -1;
return -1;
if (file_printf(ms, ", %s Endian",
si.si_byte_order == 0xfffe ? "Little" : "Big") == -1)
return -2;
switch (si.si_os) {
case 2:
if (file_printf(ms, ", Os: Windows, Version %d.%d",
si.si_os_version & 0xff,
(uint32_t)si.si_os_version >> 8) == -1)
return -2;
break;
case 1:
if (file_printf(ms, ", Os: MacOS, Version %d.%d",
(uint32_t)si.si_os_version >> 8,
si.si_os_version & 0xff) == -1)
return -2;
break;
default:
if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os,
si.si_os_version & 0xff,
(uint32_t)si.si_os_version >> 8) == -1)
return -2;
break;
}
if (file_printf(ms, ", %s Endian",
si.si_byte_order == 0xfffe ? "Little" : "Big") == -1)
return -2;
switch (si.si_os) {
case 2:
if (file_printf(ms, ", Os: Windows, Version %d.%d",
si.si_os_version & 0xff,
(uint32_t)si.si_os_version >> 8) == -1)
return -2;
break;
case 1:
if (file_printf(ms, ", Os: MacOS, Version %d.%d",
(uint32_t)si.si_os_version >> 8,
si.si_os_version & 0xff) == -1)
return -2;
break;
default:
if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os,
si.si_os_version & 0xff,
(uint32_t)si.si_os_version >> 8) == -1)
return -2;
break;
}
if (root_storage) {
str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
clsid2desc);
@ -344,10 +344,10 @@ cdf_file_summary_info(struct magic_set *ms, const cdf_header_t *h,
}
}
m = cdf_file_property_info(ms, info, count, root_storage);
free(info);
m = cdf_file_property_info(ms, info, count, root_storage);
free(info);
return m == -1 ? -2 : m;
return m == -1 ? -2 : m;
}
#ifdef notdef
@ -395,10 +395,10 @@ cdf_check_summary_info(struct magic_set *ms, const cdf_info_t *info,
size_t j, k;
#ifdef CDF_DEBUG
cdf_dump_summary_info(h, scn);
cdf_dump_summary_info(h, scn);
#endif
if ((i = cdf_file_summary_info(ms, h, scn, root_storage)) < 0) {
*expn = "Can't expand summary_info";
if ((i = cdf_file_summary_info(ms, h, scn, root_storage)) < 0) {
*expn = "Can't expand summary_info";
return i;
}
if (i == 1)
@ -542,55 +542,55 @@ file_trycdf(struct magic_set *ms, const struct buffer *b)
int fd = b->fd;
const unsigned char *buf = b->fbuf;
size_t nbytes = b->flen;
cdf_info_t info;
cdf_header_t h;
cdf_sat_t sat, ssat;
cdf_stream_t sst, scn;
cdf_dir_t dir;
int i;
const char *expn = "";
const cdf_directory_t *root_storage;
cdf_info_t info;
cdf_header_t h;
cdf_sat_t sat, ssat;
cdf_stream_t sst, scn;
cdf_dir_t dir;
int i;
const char *expn = "";
const cdf_directory_t *root_storage;
scn.sst_tab = NULL;
info.i_fd = fd;
info.i_buf = buf;
info.i_len = nbytes;
if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
return 0;
if (cdf_read_header(&info, &h) == -1)
return 0;
scn.sst_tab = NULL;
info.i_fd = fd;
info.i_buf = buf;
info.i_len = nbytes;
if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
return 0;
if (cdf_read_header(&info, &h) == -1)
return 0;
#ifdef CDF_DEBUG
cdf_dump_header(&h);
cdf_dump_header(&h);
#endif
if ((i = cdf_read_sat(&info, &h, &sat)) == -1) {
expn = "Can't read SAT";
goto out0;
}
if ((i = cdf_read_sat(&info, &h, &sat)) == -1) {
expn = "Can't read SAT";
goto out0;
}
#ifdef CDF_DEBUG
cdf_dump_sat("SAT", &sat, CDF_SEC_SIZE(&h));
cdf_dump_sat("SAT", &sat, CDF_SEC_SIZE(&h));
#endif
if ((i = cdf_read_ssat(&info, &h, &sat, &ssat)) == -1) {
expn = "Can't read SSAT";
goto out1;
}
if ((i = cdf_read_ssat(&info, &h, &sat, &ssat)) == -1) {
expn = "Can't read SSAT";
goto out1;
}
#ifdef CDF_DEBUG
cdf_dump_sat("SSAT", &ssat, CDF_SHORT_SEC_SIZE(&h));
cdf_dump_sat("SSAT", &ssat, CDF_SHORT_SEC_SIZE(&h));
#endif
if ((i = cdf_read_dir(&info, &h, &sat, &dir)) == -1) {
expn = "Can't read directory";
goto out2;
}
if ((i = cdf_read_dir(&info, &h, &sat, &dir)) == -1) {
expn = "Can't read directory";
goto out2;
}
if ((i = cdf_read_short_stream(&info, &h, &sat, &dir, &sst,
if ((i = cdf_read_short_stream(&info, &h, &sat, &dir, &sst,
&root_storage)) == -1) {
expn = "Cannot read short stream";
goto out3;
}
expn = "Cannot read short stream";
goto out3;
}
#ifdef CDF_DEBUG
cdf_dump_dir(&info, &h, &sat, &ssat, &sst, &dir);
cdf_dump_dir(&info, &h, &sat, &ssat, &sst, &dir);
#endif
#ifdef notdef
if (root_storage) {
@ -625,10 +625,10 @@ file_trycdf(struct magic_set *ms, const struct buffer *b)
}
}
if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
&scn)) == -1) {
if (errno != ESRCH) {
expn = "Cannot read summary info";
if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
&scn)) == -1) {
if (errno != ESRCH) {
expn = "Cannot read summary info";
}
} else {
i = cdf_check_summary_info(ms, &info, &h,
@ -655,11 +655,11 @@ file_trycdf(struct magic_set *ms, const struct buffer *b)
cdf_zero_stream(&scn);
cdf_zero_stream(&sst);
out3:
free(dir.dir_tab);
free(dir.dir_tab);
out2:
free(ssat.sat_tab);
free(ssat.sat_tab);
out1:
free(sat.sat_tab);
free(sat.sat_tab);
out0:
if (i == -1) {
if (NOTMIME(ms)) {
@ -675,5 +675,5 @@ file_trycdf(struct magic_set *ms, const struct buffer *b)
}
i = 1;
}
return i;
return i;
}

View File

@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: readelf.c,v 1.141 2018/04/12 16:50:52 christos Exp $")
FILE_RCSID("@(#)$File: readelf.c,v 1.144 2018/07/08 23:37:33 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@ -62,13 +62,12 @@ private uint64_t getu64(int, uint64_t);
#define MAX_PHNUM 128
#define MAX_SHNUM 32768
#define SIZE_UNKNOWN ((off_t)-1)
#define SIZE_UNKNOWN CAST(off_t, -1)
private int
toomany(struct magic_set *ms, const char *name, uint16_t num)
{
if (file_printf(ms, ", too many %s (%u)", name, num
) == -1)
if (file_printf(ms, ", too many %s (%u)", name, num) == -1)
return -1;
return 0;
}
@ -143,54 +142,55 @@ getu64(int swap, uint64_t value)
#define elf_getu64(swap, value) getu64(swap, value)
#define xsh_addr (clazz == ELFCLASS32 \
? (void *)&sh32 \
: (void *)&sh64)
? CAST(void *, &sh32) \
: CAST(void *, &sh64))
#define xsh_sizeof (clazz == ELFCLASS32 \
? sizeof(sh32) \
: sizeof(sh64))
#define xsh_size (size_t)(clazz == ELFCLASS32 \
#define xsh_size CAST(size_t, (clazz == ELFCLASS32 \
? elf_getu32(swap, sh32.sh_size) \
: elf_getu64(swap, sh64.sh_size))
#define xsh_offset (off_t)(clazz == ELFCLASS32 \
: elf_getu64(swap, sh64.sh_size)))
#define xsh_offset CAST(off_t, (clazz == ELFCLASS32 \
? elf_getu32(swap, sh32.sh_offset) \
: elf_getu64(swap, sh64.sh_offset))
: elf_getu64(swap, sh64.sh_offset)))
#define xsh_type (clazz == ELFCLASS32 \
? elf_getu32(swap, sh32.sh_type) \
: elf_getu32(swap, sh64.sh_type))
#define xsh_name (clazz == ELFCLASS32 \
? elf_getu32(swap, sh32.sh_name) \
: elf_getu32(swap, sh64.sh_name))
#define xph_addr (clazz == ELFCLASS32 \
? (void *) &ph32 \
: (void *) &ph64)
? CAST(void *, &ph32) \
: CAST(void *, &ph64))
#define xph_sizeof (clazz == ELFCLASS32 \
? sizeof(ph32) \
: sizeof(ph64))
#define xph_type (clazz == ELFCLASS32 \
? elf_getu32(swap, ph32.p_type) \
: elf_getu32(swap, ph64.p_type))
#define xph_offset (off_t)(clazz == ELFCLASS32 \
#define xph_offset CAST(off_t, (clazz == ELFCLASS32 \
? elf_getu32(swap, ph32.p_offset) \
: elf_getu64(swap, ph64.p_offset))
#define xph_align (size_t)((clazz == ELFCLASS32 \
? (off_t) (ph32.p_align ? \
elf_getu32(swap, ph32.p_align) : 4) \
: (off_t) (ph64.p_align ? \
elf_getu64(swap, ph64.p_align) : 4)))
#define xph_vaddr (size_t)((clazz == ELFCLASS32 \
? (off_t) (ph32.p_vaddr ? \
elf_getu32(swap, ph32.p_vaddr) : 4) \
: (off_t) (ph64.p_vaddr ? \
elf_getu64(swap, ph64.p_vaddr) : 4)))
#define xph_filesz (size_t)((clazz == ELFCLASS32 \
: elf_getu64(swap, ph64.p_offset)))
#define xph_align CAST(size_t, (clazz == ELFCLASS32 \
? CAST(off_t, (ph32.p_align ? \
elf_getu32(swap, ph32.p_align) : 4))\
: CAST(off_t, (ph64.p_align ? \
elf_getu64(swap, ph64.p_align) : 4))))
#define xph_vaddr CAST(size_t, (clazz == ELFCLASS32 \
? CAST(off_t, (ph32.p_vaddr ? \
elf_getu32(swap, ph32.p_vaddr) : 4))\
: CAST(off_t, (ph64.p_vaddr ? \
elf_getu64(swap, ph64.p_vaddr) : 4))))
#define xph_filesz CAST(size_t, (clazz == ELFCLASS32 \
? elf_getu32(swap, ph32.p_filesz) \
: elf_getu64(swap, ph64.p_filesz)))
#define xnh_addr (clazz == ELFCLASS32 \
? (void *)&nh32 \
: (void *)&nh64)
#define xph_memsz (size_t)((clazz == ELFCLASS32 \
#define xph_memsz CAST(size_t, ((clazz == ELFCLASS32 \
? elf_getu32(swap, ph32.p_memsz) \
: elf_getu64(swap, ph64.p_memsz)))
: elf_getu64(swap, ph64.p_memsz))))
#define xnh_addr (clazz == ELFCLASS32 \
? CAST(void *, &nh32) \
: CAST(void *, &nh64))
#define xnh_sizeof (clazz == ELFCLASS32 \
? sizeof(nh32) \
: sizeof(nh64))
@ -203,24 +203,36 @@ getu64(int swap, uint64_t value)
#define xnh_descsz (clazz == ELFCLASS32 \
? elf_getu32(swap, nh32.n_descsz) \
: elf_getu32(swap, nh64.n_descsz))
#define prpsoffsets(i) (clazz == ELFCLASS32 \
? prpsoffsets32[i] \
: prpsoffsets64[i])
#define xdh_addr (clazz == ELFCLASS32 \
? CAST(void *, &dh32) \
: CAST(void *, &dh64))
#define xdh_sizeof (clazz == ELFCLASS32 \
? sizeof(dh32) \
: sizeof(dh64))
#define xdh_tag (clazz == ELFCLASS32 \
? elf_getu32(swap, dh32.d_tag) \
: elf_getu64(swap, dh64.d_tag))
#define xdh_val (clazz == ELFCLASS32 \
? elf_getu32(swap, dh32.d_un.d_val) \
: elf_getu64(swap, dh64.d_un.d_val))
#define xcap_addr (clazz == ELFCLASS32 \
? (void *)&cap32 \
: (void *)&cap64)
? CAST(void *, &cap32) \
: CAST(void *, &cap64))
#define xcap_sizeof (clazz == ELFCLASS32 \
? sizeof cap32 \
: sizeof cap64)
? sizeof(cap32) \
: sizeof(cap64))
#define xcap_tag (clazz == ELFCLASS32 \
? elf_getu32(swap, cap32.c_tag) \
: elf_getu64(swap, cap64.c_tag))
#define xcap_val (clazz == ELFCLASS32 \
? elf_getu32(swap, cap32.c_un.c_val) \
: elf_getu64(swap, cap64.c_un.c_val))
#define xauxv_addr (clazz == ELFCLASS32 \
? (void *)&auxv32 \
: (void *)&auxv64)
? CAST(void *, &auxv32) \
: CAST(void *, &auxv64))
#define xauxv_sizeof (clazz == ELFCLASS32 \
? sizeof(auxv32) \
: sizeof(auxv64))
@ -231,6 +243,10 @@ getu64(int swap, uint64_t value)
? elf_getu32(swap, auxv32.a_v) \
: elf_getu64(swap, auxv64.a_v))
#define prpsoffsets(i) (clazz == ELFCLASS32 \
? prpsoffsets32[i] \
: prpsoffsets64[i])
#ifdef ELFCORE
/*
* Try larger offsets first to avoid false matches
@ -266,8 +282,8 @@ static const size_t prpsoffsets64[] = {
16, /* FreeBSD, 64-bit */
};
#define NOFFSETS32 (sizeof prpsoffsets32 / sizeof prpsoffsets32[0])
#define NOFFSETS64 (sizeof prpsoffsets64 / sizeof prpsoffsets64[0])
#define NOFFSETS32 (sizeof(prpsoffsets32) / sizeof(prpsoffsets32[0]))
#define NOFFSETS64 (sizeof(prpsoffsets64) / sizeof(prpsoffsets64[0]))
#define NOFFSETS (clazz == ELFCLASS32 ? NOFFSETS32 : NOFFSETS64)
@ -346,7 +362,8 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
* Loop through all the program headers.
*/
for ( ; num; num--) {
if (pread(fd, xph_addr, xph_sizeof, off) < (ssize_t)xph_sizeof) {
if (pread(fd, xph_addr, xph_sizeof, off) <
CAST(ssize_t, xph_sizeof)) {
file_badread(ms);
return -1;
}
@ -389,7 +406,7 @@ static void
do_note_netbsd_version(struct magic_set *ms, int swap, void *v)
{
uint32_t desc;
(void)memcpy(&desc, v, sizeof(desc));
memcpy(&desc, v, sizeof(desc));
desc = elf_getu32(swap, desc);
if (file_printf(ms, ", for NetBSD") == -1)
@ -435,7 +452,7 @@ do_note_freebsd_version(struct magic_set *ms, int swap, void *v)
{
uint32_t desc;
(void)memcpy(&desc, v, sizeof(desc));
memcpy(&desc, v, sizeof(desc));
desc = elf_getu32(swap, desc);
if (file_printf(ms, ", for FreeBSD") == -1)
return;
@ -533,12 +550,19 @@ do_bid_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
}
if (file_printf(ms, ", BuildID[%s]=", btype) == -1)
return 1;
(void)memcpy(desc, &nbuf[doff], descsz);
memcpy(desc, &nbuf[doff], descsz);
for (i = 0; i < descsz; i++)
if (file_printf(ms, "%02x", desc[i]) == -1)
return 1;
return 1;
}
if (namesz == 4 && strcmp((char *)&nbuf[noff], "Go") == 0 &&
type == NT_GO_BUILD_ID && descsz < 128) {
if (file_printf(ms, ", Go BuildID=%s",
(char *)&nbuf[doff]) == -1)
return 1;
return 1;
}
return 0;
}
@ -557,7 +581,7 @@ do_os_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
type == NT_GNU_VERSION && descsz == 16) {
uint32_t desc[4];
(void)memcpy(desc, &nbuf[doff], sizeof(desc));
memcpy(desc, &nbuf[doff], sizeof(desc));
*flags |= FLAGS_DID_OS_NOTE;
if (file_printf(ms, ", for GNU/") == -1)
@ -624,7 +648,7 @@ do_os_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
*flags |= FLAGS_DID_OS_NOTE;
if (file_printf(ms, ", for DragonFly") == -1)
return 1;
(void)memcpy(&desc, &nbuf[doff], sizeof(desc));
memcpy(&desc, &nbuf[doff], sizeof(desc));
desc = elf_getu32(swap, desc);
if (file_printf(ms, " %d.%d.%d", desc / 100000,
desc / 10000 % 10, desc % 10000) == -1)
@ -654,7 +678,7 @@ do_pax_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
int did = 0;
*flags |= FLAGS_DID_NETBSD_PAX;
(void)memcpy(&desc, &nbuf[doff], sizeof(desc));
memcpy(&desc, &nbuf[doff], sizeof(desc));
desc = elf_getu32(swap, desc);
if (desc && file_printf(ms, ", PaX: ") == -1)
@ -825,7 +849,8 @@ do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
cname = (unsigned char *)
&nbuf[doff + prpsoffsets(i)];
for (cp = cname; *cp && isprint(*cp); cp++)
for (cp = cname; cp < nbuf + size && *cp
&& isprint(*cp); cp++)
continue;
/*
* Linux apparently appends a space at the end
@ -953,7 +978,7 @@ do_auxv_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
nval = 0;
for (size_t off = 0; off + elsize <= descsz; off += elsize) {
(void)memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
/* Limit processing to 50 vector entries to prevent DoS */
if (nval++ >= 50) {
file_error(ms, 0, "Too many ELF Auxv elements");
@ -1017,6 +1042,38 @@ do_auxv_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
#endif
}
private size_t
dodynamic(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
int clazz, int swap)
{
Elf32_Dyn dh32;
Elf64_Dyn dh64;
unsigned char *dbuf = CAST(unsigned char *, vbuf);
if (xdh_sizeof + offset > size) {
/*
* We're out of note headers.
*/
return xdh_sizeof + offset;
}
memcpy(xdh_addr, &dbuf[offset], xdh_sizeof);
offset += xdh_sizeof;
switch (xdh_tag) {
case DT_FLAGS_1:
if (xdh_val == DF_1_PIE)
ms->mode |= 0111;
else
ms->mode &= ~0111;
break;
default:
break;
}
return offset;
}
private size_t
donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
int clazz, int swap, size_t align, int *flags, uint16_t *notecount,
@ -1039,7 +1096,7 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
return xnh_sizeof + offset;
}
(void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
offset += xnh_sizeof;
namesz = xnh_namesz;
@ -1053,14 +1110,14 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
}
if (namesz & 0x80000000) {
(void)file_printf(ms, ", bad note name size %#lx",
(unsigned long)namesz);
file_printf(ms, ", bad note name size %#lx",
CAST(unsigned long, namesz));
return 0;
}
if (descsz & 0x80000000) {
(void)file_printf(ms, ", bad note description size %#lx",
(unsigned long)descsz);
file_printf(ms, ", bad note description size %#lx",
CAST(unsigned long, descsz));
return 0;
}
@ -1114,35 +1171,25 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
return offset;
}
if (namesz == 7 && strcmp((char *)&nbuf[noff], "NetBSD") == 0) {
if (namesz == 7 && strcmp(CAST(char *, &nbuf[noff]), "NetBSD") == 0) {
int descw, flag;
const char *str, *tag;
if (descsz > 100)
descsz = 100;
switch (xnh_type) {
case NT_NETBSD_VERSION:
return offset;
case NT_NETBSD_MARCH:
if (*flags & FLAGS_DID_NETBSD_MARCH)
return offset;
*flags |= FLAGS_DID_NETBSD_MARCH;
if (file_printf(ms, ", compiled for: %.*s",
(int)descsz, (const char *)&nbuf[doff]) == -1)
return offset;
flag = FLAGS_DID_NETBSD_MARCH;
tag = "compiled for";
break;
case NT_NETBSD_CMODEL:
if (*flags & FLAGS_DID_NETBSD_CMODEL)
return offset;
*flags |= FLAGS_DID_NETBSD_CMODEL;
if (file_printf(ms, ", compiler model: %.*s",
(int)descsz, (const char *)&nbuf[doff]) == -1)
return offset;
flag = FLAGS_DID_NETBSD_CMODEL;
tag = "compiler model";
break;
case NT_NETBSD_EMULATION:
if (*flags & FLAGS_DID_NETBSD_EMULATION)
return offset;
*flags |= FLAGS_DID_NETBSD_EMULATION;
if (file_printf(ms, ", emulation: %.*s",
(int)descsz, (const char *)&nbuf[doff]) == -1)
return offset;
flag = FLAGS_DID_NETBSD_EMULATION;
tag = "emulation:";
break;
default:
if (*flags & FLAGS_DID_NETBSD_UNKNOWN)
@ -1150,8 +1197,15 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
*flags |= FLAGS_DID_NETBSD_UNKNOWN;
if (file_printf(ms, ", note=%u", xnh_type) == -1)
return offset;
break;
return offset;
}
if (*flags & flag)
return offset;
str = CAST(const char *, &nbuf[doff]);
descw = CAST(int, descsz);
*flags |= flag;
file_printf(ms, ", %s: %.*s", tag, descw, str);
return offset;
}
@ -1232,7 +1286,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
/* Read offset of name section to be able to read section names later */
if (pread(fd, xsh_addr, xsh_sizeof, CAST(off_t, (off + size * strtab)))
< (ssize_t)xsh_sizeof) {
< CAST(ssize_t, xsh_sizeof)) {
if (file_printf(ms, ", missing section headers") == -1)
return -1;
return 0;
@ -1241,7 +1295,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
for ( ; num; num--) {
/* Read the name of this section. */
if ((namesize = pread(fd, name, sizeof(name) - 1, name_off + xsh_name)) == -1) {
if ((namesize = pread(fd, name, sizeof(name) - 1,
name_off + xsh_name)) == -1) {
file_badread(ms);
return -1;
}
@ -1251,7 +1306,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
stripped = 0;
}
if (pread(fd, xsh_addr, xsh_sizeof, off) < (ssize_t)xsh_sizeof) {
if (pread(fd, xsh_addr, xsh_sizeof, off) <
CAST(ssize_t, xsh_sizeof)) {
file_badread(ms);
return -1;
}
@ -1277,14 +1333,15 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
/* Things we can determine when we seek */
switch (xsh_type) {
case SHT_NOTE:
if ((uintmax_t)(xsh_size + xsh_offset) >
(uintmax_t)fsize) {
if (CAST(uintmax_t, (xsh_size + xsh_offset)) >
CAST(uintmax_t, fsize)) {
if (file_printf(ms,
", note offset/size %#" INTMAX_T_FORMAT
"x+%#" INTMAX_T_FORMAT "x exceeds"
" file size %#" INTMAX_T_FORMAT "x",
(uintmax_t)xsh_offset, (uintmax_t)xsh_size,
(uintmax_t)fsize) == -1)
CAST(uintmax_t, xsh_offset),
CAST(uintmax_t, xsh_size),
CAST(uintmax_t, fsize)) == -1)
return -1;
return 0;
}
@ -1294,7 +1351,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
return -1;
}
if (pread(fd, nbuf, xsh_size, xsh_offset) <
(ssize_t)xsh_size) {
CAST(ssize_t, xsh_size)) {
file_badread(ms);
free(nbuf);
return -1;
@ -1302,9 +1359,9 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
noff = 0;
for (;;) {
if (noff >= (off_t)xsh_size)
if (noff >= CAST(off_t, xsh_size))
break;
noff = donote(ms, nbuf, (size_t)noff,
noff = donote(ms, nbuf, CAST(size_t, noff),
xsh_size, clazz, swap, 4, flags, notecount,
fd, 0, 0, 0);
if (noff == 0)
@ -1326,7 +1383,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
if (nbadcap > 5)
break;
if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) {
if (lseek(fd, xsh_offset, SEEK_SET)
== CAST(off_t, -1)) {
file_badseek(ms);
return -1;
}
@ -1335,11 +1393,12 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
Elf32_Cap cap32;
Elf64_Cap cap64;
char cbuf[/*CONSTCOND*/
MAX(sizeof cap32, sizeof cap64)];
if ((coff += xcap_sizeof) > (off_t)xsh_size)
MAX(sizeof(cap32), sizeof(cap64))];
if ((coff += xcap_sizeof) >
CAST(off_t, xsh_size))
break;
if (read(fd, cbuf, (size_t)xcap_sizeof) !=
(ssize_t)xcap_sizeof) {
if (read(fd, cbuf, CAST(size_t, xcap_sizeof)) !=
CAST(ssize_t, xcap_sizeof)) {
file_badread(ms);
return -1;
}
@ -1373,7 +1432,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
#endif
break;
}
(void)memcpy(xcap_addr, cbuf, xcap_sizeof);
memcpy(xcap_addr, cbuf, xcap_sizeof);
switch (xcap_tag) {
case CA_SUNW_NULL:
break;
@ -1388,8 +1447,9 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
", with unknown capability "
"%#" INT64_T_FORMAT "x = %#"
INT64_T_FORMAT "x",
(unsigned long long)xcap_tag,
(unsigned long long)xcap_val) == -1)
CAST(unsigned long long, xcap_tag),
CAST(unsigned long long, xcap_val))
== -1)
return -1;
if (nbadcap++ > 2)
coff = xsh_size;
@ -1442,12 +1502,12 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
if (file_printf(ms,
" unknown hardware capability %#"
INT64_T_FORMAT "x",
(unsigned long long)cap_hw1) == -1)
CAST(unsigned long long, cap_hw1)) == -1)
return -1;
} else {
if (file_printf(ms,
" hardware capability %#" INT64_T_FORMAT "x",
(unsigned long long)cap_hw1) == -1)
CAST(unsigned long long, cap_hw1)) == -1)
return -1;
}
}
@ -1464,7 +1524,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
if (file_printf(ms,
", with unknown software capability %#"
INT64_T_FORMAT "x",
(unsigned long long)cap_sf1) == -1)
CAST(unsigned long long, cap_sf1)) == -1)
return -1;
}
return 0;
@ -1483,9 +1543,9 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
Elf32_Phdr ph32;
Elf64_Phdr ph64;
const char *linking_style = "statically";
const char *interp = "";
unsigned char nbuf[BUFSIZ];
char ibuf[BUFSIZ];
char interp[BUFSIZ];
ssize_t bufsize;
size_t offset, align, len;
@ -1495,8 +1555,11 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
return 0;
}
interp[0] = '\0';
for ( ; num; num--) {
if (pread(fd, xph_addr, xph_sizeof, off) < (ssize_t)xph_sizeof) {
int doread;
if (pread(fd, xph_addr, xph_sizeof, off) <
CAST(ssize_t, xph_sizeof)) {
file_badread(ms);
return -1;
}
@ -1509,6 +1572,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
switch (xph_type) {
case PT_DYNAMIC:
linking_style = "dynamically";
doread = 1;
break;
case PT_NOTE:
if (sh_num) /* Did this through section headers */
@ -1517,21 +1581,16 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
align < 4) {
if (file_printf(ms,
", invalid note alignment %#lx",
(unsigned long)align) == -1)
CAST(unsigned long, align)) == -1)
return -1;
align = 4;
}
/*FALLTHROUGH*/
case PT_INTERP:
len = xph_filesz < sizeof(nbuf) ? xph_filesz
: sizeof(nbuf);
bufsize = pread(fd, nbuf, len, xph_offset);
if (bufsize == -1) {
file_badread(ms);
return -1;
}
doread = 1;
break;
default:
doread = 0;
if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
/* Maybe warn here? */
continue;
@ -1539,14 +1598,37 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
break;
}
if (doread) {
len = xph_filesz < sizeof(nbuf) ? xph_filesz
: sizeof(nbuf);
bufsize = pread(fd, nbuf, len, xph_offset);
if (bufsize == -1) {
file_badread(ms);
return -1;
}
} else
len = 0;
/* Things we can determine when we seek */
switch (xph_type) {
case PT_DYNAMIC:
offset = 0;
for (;;) {
if (offset >= (size_t)bufsize)
break;
offset = dodynamic(ms, nbuf, offset,
CAST(size_t, bufsize), clazz, swap);
if (offset == 0)
break;
}
break;
case PT_INTERP:
if (bufsize && nbuf[0]) {
nbuf[bufsize - 1] = '\0';
interp = (const char *)nbuf;
memcpy(interp, nbuf, bufsize);
} else
interp = "*empty*";
strlcpy(interp, "*empty*", sizeof(interp));
break;
case PT_NOTE:
/*
@ -1558,7 +1640,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
if (offset >= (size_t)bufsize)
break;
offset = donote(ms, nbuf, offset,
(size_t)bufsize, clazz, swap, align,
CAST(size_t, bufsize), clazz, swap, align,
flags, notecount, fd, 0, 0, 0);
if (offset == 0)
break;
@ -1587,7 +1669,7 @@ file_tryelf(struct magic_set *ms, const struct buffer *b)
size_t nbytes = b->flen;
union {
int32_t l;
char c[sizeof (int32_t)];
char c[sizeof(int32_t)];
} u;
int clazz;
int swap;
@ -1615,7 +1697,8 @@ file_tryelf(struct magic_set *ms, const struct buffer *b)
/*
* If we cannot seek, it must be a pipe, socket or fifo.
*/
if((lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE))
if((lseek(fd, CAST(off_t, 0), SEEK_SET) == CAST(off_t, -1))
&& (errno == ESPIPE))
fd = file_pipe2file(ms, fd, buf, nbytes);
if (fstat(fd, &st) == -1) {

View File

@ -355,6 +355,15 @@ typedef struct {
*/
#define NT_NETBSD_CMODEL 6
/*
* Golang-specific note type
* name: Go\0\0
* namesz: 4
* desc: base-64 build id.
* descsz: < 128
*/
#define NT_GO_BUILD_ID 4
/*
* FreeBSD specific notes
*/
@ -430,4 +439,107 @@ typedef struct {
#define AV_386_SSE4_1 0x00800000
#define AV_386_SSE4_2 0x01000000
/*
* Dynamic Section structure array
*/
typedef struct {
Elf32_Word d_tag; /* entry tag value */
union {
Elf32_Addr d_ptr;
Elf32_Word d_val;
} d_un;
} Elf32_Dyn;
typedef struct {
Elf64_Xword d_tag; /* entry tag value */
union {
Elf64_Addr d_ptr;
Elf64_Xword d_val;
} d_un;
} Elf64_Dyn;
/* d_tag */
#define DT_NULL 0 /* Marks end of dynamic array */
#define DT_NEEDED 1 /* Name of needed library (DT_STRTAB offset) */
#define DT_PLTRELSZ 2 /* Size, in bytes, of relocations in PLT */
#define DT_PLTGOT 3 /* Address of PLT and/or GOT */
#define DT_HASH 4 /* Address of symbol hash table */
#define DT_STRTAB 5 /* Address of string table */
#define DT_SYMTAB 6 /* Address of symbol table */
#define DT_RELA 7 /* Address of Rela relocation table */
#define DT_RELASZ 8 /* Size, in bytes, of DT_RELA table */
#define DT_RELAENT 9 /* Size, in bytes, of one DT_RELA entry */
#define DT_STRSZ 10 /* Size, in bytes, of DT_STRTAB table */
#define DT_SYMENT 11 /* Size, in bytes, of one DT_SYMTAB entry */
#define DT_INIT 12 /* Address of initialization function */
#define DT_FINI 13 /* Address of termination function */
#define DT_SONAME 14 /* Shared object name (DT_STRTAB offset) */
#define DT_RPATH 15 /* Library search path (DT_STRTAB offset) */
#define DT_SYMBOLIC 16 /* Start symbol search within local object */
#define DT_REL 17 /* Address of Rel relocation table */
#define DT_RELSZ 18 /* Size, in bytes, of DT_REL table */
#define DT_RELENT 19 /* Size, in bytes, of one DT_REL entry */
#define DT_PLTREL 20 /* Type of PLT relocation entries */
#define DT_DEBUG 21 /* Used for debugging; unspecified */
#define DT_TEXTREL 22 /* Relocations might modify non-writable seg */
#define DT_JMPREL 23 /* Address of relocations associated with PLT */
#define DT_BIND_NOW 24 /* Process all relocations at load-time */
#define DT_INIT_ARRAY 25 /* Address of initialization function array */
#define DT_FINI_ARRAY 26 /* Size, in bytes, of DT_INIT_ARRAY array */
#define DT_INIT_ARRAYSZ 27 /* Address of termination function array */
#define DT_FINI_ARRAYSZ 28 /* Size, in bytes, of DT_FINI_ARRAY array*/
#define DT_RUNPATH 29 /* overrides DT_RPATH */
#define DT_FLAGS 30 /* Encodes ORIGIN, SYMBOLIC, TEXTREL, BIND_NOW, STATIC_TLS */
#define DT_ENCODING 31 /* ??? */
#define DT_PREINIT_ARRAY 32 /* Address of pre-init function array */
#define DT_PREINIT_ARRAYSZ 33 /* Size, in bytes, of DT_PREINIT_ARRAY array */
#define DT_NUM 34
#define DT_LOOS 0x60000000 /* Operating system specific range */
#define DT_VERSYM 0x6ffffff0 /* Symbol versions */
#define DT_FLAGS_1 0x6ffffffb /* ELF dynamic flags */
#define DT_VERDEF 0x6ffffffc /* Versions defined by file */
#define DT_VERDEFNUM 0x6ffffffd /* Number of versions defined by file */
#define DT_VERNEED 0x6ffffffe /* Versions needed by file */
#define DT_VERNEEDNUM 0x6fffffff /* Number of versions needed by file */
#define DT_HIOS 0x6fffffff
#define DT_LOPROC 0x70000000 /* Processor-specific range */
#define DT_HIPROC 0x7fffffff
/* Flag values for DT_FLAGS */
#define DF_ORIGIN 0x00000001 /* uses $ORIGIN */
#define DF_SYMBOLIC 0x00000002 /* */
#define DF_TEXTREL 0x00000004 /* */
#define DF_BIND_NOW 0x00000008 /* */
#define DF_STATIC_TLS 0x00000010 /* */
/* Flag values for DT_FLAGS_1 */
#define DF_1_NOW 0x00000001 /* Same as DF_BIND_NOW */
#define DF_1_GLOBAL 0x00000002 /* Unused */
#define DF_1_GROUP 0x00000004 /* Is member of group */
#define DF_1_NODELETE 0x00000008 /* Cannot be deleted from process */
#define DF_1_LOADFLTR 0x00000010 /* Immediate loading of filters */
#define DF_1_INITFIRST 0x00000020 /* init/fini takes priority */
#define DF_1_NOOPEN 0x00000040 /* Do not allow loading on dlopen() */
#define DF_1_ORIGIN 0x00000080 /* Require $ORIGIN processing */
#define DF_1_DIRECT 0x00000100 /* Enable direct bindings */
#define DF_1_INTERPOSE 0x00000400 /* Is an interposer */
#define DF_1_NODEFLIB 0x00000800 /* Ignore default library search path */
#define DF_1_NODUMP 0x00001000 /* Cannot be dumped with dldump(3C) */
#define DF_1_CONFALT 0x00002000 /* Configuration alternative */
#define DF_1_ENDFILTEE 0x00004000 /* Filtee ends filter's search */
#define DF_1_DISPRELDNE 0x00008000 /* Did displacement relocation */
#define DF_1_DISPRELPND 0x00010000 /* Pending displacement relocation */
#define DF_1_NODIRECT 0x00020000 /* Has non-direct bindings */
#define DF_1_IGNMULDEF 0x00040000 /* Used internally */
#define DF_1_NOKSYMS 0x00080000 /* Used internally */
#define DF_1_NOHDR 0x00100000 /* Used internally */
#define DF_1_EDITED 0x00200000 /* Has been modified since build */
#define DF_1_NORELOC 0x00400000 /* Used internally */
#define DF_1_SYMINTPOSE 0x00800000 /* Has individual symbol interposers */
#define DF_1_GLOBAUDIT 0x01000000 /* Require global auditing */
#define DF_1_SINGLETON 0x02000000 /* Has singleton symbols */
#define DF_1_STUB 0x04000000 /* Stub */
#define DF_1_PIE 0x08000000 /* Position Independent Executable */
#endif

View File

@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: seccomp.c,v 1.2 2017/11/04 01:14:25 christos Exp $")
FILE_RCSID("@(#)$File: seccomp.c,v 1.6 2018/06/26 20:29:29 christos Exp $")
#endif /* lint */
#if HAVE_LIBSECCOMP
@ -59,12 +59,7 @@ enable_sandbox_basic(void)
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == -1)
return -1;
#if 0
// prevent escape via ptrace
prctl(PR_SET_DUMPABLE, 0);
#endif
if (prctl (PR_SET_DUMPABLE, 0, 0, 0, 0) == -1)
if (prctl(PR_SET_DUMPABLE, 0, 0, 0, 0) == -1)
return -1;
// initialize the filter
@ -169,15 +164,26 @@ enable_sandbox_full(void)
ALLOW_RULE(exit);
ALLOW_RULE(exit_group);
ALLOW_RULE(fcntl);
ALLOW_RULE(fcntl64);
ALLOW_RULE(fstat);
ALLOW_RULE(fstat64);
ALLOW_RULE(getdents);
#ifdef __NR_getdents64
ALLOW_RULE(getdents64);
#endif
ALLOW_RULE(ioctl);
ALLOW_RULE(lseek);
ALLOW_RULE(_llseek);
ALLOW_RULE(lstat);
ALLOW_RULE(lstat64);
ALLOW_RULE(mmap);
ALLOW_RULE(mmap2);
ALLOW_RULE(mprotect);
ALLOW_RULE(mremap);
ALLOW_RULE(munmap);
#ifdef __NR_newfstatat
ALLOW_RULE(newfstatat);
#endif
ALLOW_RULE(open);
ALLOW_RULE(openat);
ALLOW_RULE(pread64);
@ -188,6 +194,7 @@ enable_sandbox_full(void)
ALLOW_RULE(rt_sigreturn);
ALLOW_RULE(select);
ALLOW_RULE(stat);
ALLOW_RULE(stat64);
ALLOW_RULE(sysinfo);
ALLOW_RULE(unlink);
ALLOW_RULE(write);

View File

@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
FILE_RCSID("@(#)$File: softmagic.c,v 1.259 2018/03/11 01:23:52 christos Exp $")
FILE_RCSID("@(#)$File: softmagic.c,v 1.262 2018/06/22 20:39:50 christos Exp $")
#endif /* lint */
#include "magic.h"
@ -53,8 +53,7 @@ private int mget(struct magic_set *, struct magic *, const struct buffer *,
private int msetoffset(struct magic_set *, struct magic *, struct buffer *,
const struct buffer *, size_t, unsigned int);
private int magiccheck(struct magic_set *, struct magic *);
private int32_t mprint(struct magic_set *, struct magic *,
const struct buffer *);
private int32_t mprint(struct magic_set *, struct magic *);
private int moffset(struct magic_set *, struct magic *, const struct buffer *,
int32_t *);
private void mdebug(uint32_t, const char *, size_t);
@ -62,8 +61,7 @@ private int mcopy(struct magic_set *, union VALUETYPE *, int, int,
const unsigned char *, uint32_t, size_t, struct magic *);
private int mconvert(struct magic_set *, struct magic *, int);
private int print_sep(struct magic_set *, int);
private int handle_annotation(struct magic_set *, struct magic *,
const struct buffer *, int);
private int handle_annotation(struct magic_set *, struct magic *, int);
private int cvt_8(union VALUETYPE *, const struct magic *);
private int cvt_16(union VALUETYPE *, const struct magic *);
private int cvt_32(union VALUETYPE *, const struct magic *);
@ -240,7 +238,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
goto flush;
}
if ((e = handle_annotation(ms, m, b, firstline)) != 0) {
if ((e = handle_annotation(ms, m, firstline)) != 0) {
*need_separator = 1;
*printed_something = 1;
*returnval = 1;
@ -258,7 +256,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
return -1;
}
if (print && mprint(ms, m, b) == -1)
if (print && mprint(ms, m) == -1)
return -1;
switch (moffset(ms, m, &bb, &ms->c.li[cont_level].off)) {
@ -339,7 +337,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
} else
ms->c.li[cont_level].got_match = 1;
if ((e = handle_annotation(ms, m, b, firstline))
if ((e = handle_annotation(ms, m, firstline))
!= 0) {
*need_separator = 1;
*printed_something = 1;
@ -373,7 +371,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
return -1;
*need_separator = 0;
}
if (print && mprint(ms, m, b) == -1)
if (print && mprint(ms, m) == -1)
return -1;
switch (moffset(ms, m, &bb,
@ -433,8 +431,11 @@ check_fmt(struct magic_set *ms, const char *fmt)
return rv;
}
#ifndef HAVE_STRNDUP
char * strndup(const char *, size_t);
#if !defined(HAVE_STRNDUP) || defined(__aiws__)
# ifdef __aiws__
# define strndup aix_strndup /* aix is broken */
# endif
char *strndup(const char *, size_t);
char *
strndup(const char *str, size_t n)
@ -453,7 +454,7 @@ strndup(const char *str, size_t n)
#endif /* HAVE_STRNDUP */
static int
varexpand(char *buf, size_t len, const struct buffer *b, const char *str)
varexpand(struct magic_set *ms, char *buf, size_t len, const char *str)
{
const char *ptr, *sptr, *e, *t, *ee, *et;
size_t l;
@ -478,7 +479,7 @@ varexpand(char *buf, size_t len, const struct buffer *b, const char *str)
return -1;
switch (*ptr) {
case 'x':
if (b->st.st_mode & 0111) {
if (ms->mode & 0111) {
ptr = t;
l = et - t;
} else {
@ -508,7 +509,7 @@ varexpand(char *buf, size_t len, const struct buffer *b, const char *str)
private int32_t
mprint(struct magic_set *ms, struct magic *m, const struct buffer *b)
mprint(struct magic_set *ms, struct magic *m)
{
uint64_t v;
float vf;
@ -518,7 +519,7 @@ mprint(struct magic_set *ms, struct magic *m, const struct buffer *b)
const char *desc;
union VALUETYPE *p = &ms->ms_value;
if (varexpand(ebuf, sizeof(ebuf), b, m->desc) == -1)
if (varexpand(ms, ebuf, sizeof(ebuf), m->desc) == -1)
desc = m->desc;
else
desc = ebuf;
@ -1534,6 +1535,14 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
case FILE_MELONG:
off = SEXT(sgn,32,ME32(q));
break;
case FILE_BEQUAD:
off = SEXT(sgn,64,BE64(q));
break;
case FILE_LEQUAD:
off = SEXT(sgn,64,LE64(q));
break;
default:
abort();
}
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "indirect offs=%jd\n", off);
@ -1587,8 +1596,18 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
return 0;
offset = do_ops(m, SEXT(sgn,32,p->l), off);
break;
default:
case FILE_LEQUAD:
if (OFFSET_OOB(nbytes, offset, 8))
return 0;
offset = do_ops(m, SEXT(sgn,64,LE64(p)), off);
break;
case FILE_BEQUAD:
if (OFFSET_OOB(nbytes, offset, 8))
return 0;
offset = do_ops(m, SEXT(sgn,64,BE64(p)), off);
break;
default:
abort();
}
if (m->flag & INDIROFFADD) {
@ -2159,8 +2178,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
}
private int
handle_annotation(struct magic_set *ms, struct magic *m, const struct buffer *b,
int firstline)
handle_annotation(struct magic_set *ms, struct magic *m, int firstline)
{
if ((ms->flags & MAGIC_APPLE) && m->apple[0]) {
if (!firstline && file_printf(ms, "\n- ") == -1)
@ -2181,7 +2199,7 @@ handle_annotation(struct magic_set *ms, struct magic *m, const struct buffer *b,
const char *p;
if (!firstline && file_printf(ms, "\n- ") == -1)
return -1;
if (varexpand(buf, sizeof(buf), b, m->mimetype) == -1)
if (varexpand(ms, buf, sizeof(buf), m->mimetype) == -1)
p = m->mimetype;
else
p = buf;

View File

@ -0,0 +1 @@
Audio file with ID3 version 2.2.0, contains:MPEG ADTS, layer III, v1, 96 kbps, 44.1 kHz, Monaural

Binary file not shown.

View File

@ -10,7 +10,9 @@ gedcom.testfile \
hddrawcopytool.result \
hddrawcopytool.testfile \
issue311docx.result \
issue311docx.testfile
issue311docx.testfile \
JW07022A.mp3.result \
JW07022A.mp3.testfile
T = $(top_srcdir)/tests
check-local:

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.13.1 from Makefile.am.
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -14,23 +14,61 @@
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
test $$am__dry = yes; \
}
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
@ -50,8 +88,6 @@ build_triplet = @build@
host_triplet = @host@
check_PROGRAMS = test$(EXEEXT)
subdir = tests
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@ -59,6 +95,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@ -130,6 +167,7 @@ am__define_uniq_tagged_files = \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgdatadir = @pkgdatadir@
ACLOCAL = @ACLOCAL@
@ -143,6 +181,7 @@ AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
@ -158,6 +197,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_VISIBILITY = @HAVE_VISIBILITY@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@ -259,7 +299,9 @@ gedcom.testfile \
hddrawcopytool.result \
hddrawcopytool.testfile \
issue311docx.result \
issue311docx.testfile
issue311docx.testfile \
JW07022A.mp3.result \
JW07022A.mp3.testfile
T = $(top_srcdir)/tests
all: all-am
@ -278,7 +320,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign tests/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@ -305,6 +346,7 @@ clean-checkPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) $(EXTRA_test_DEPENDENCIES)
@rm -f test$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_OBJECTS) $(test_LDADD) $(LIBS)
@ -566,6 +608,8 @@ uninstall-am:
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
check-local:
MAGIC=$(top_builddir)/magic/magic ./test
set -e; for i in $T/*.testfile; do echo Running test: $$i; TZ=UTC MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done

View File

@ -364,7 +364,7 @@ void check_options ()
output_chain = filter_create_int(NULL, filter_tee_header, headerfilename);
if ( !(m4 = getenv("M4")))
m4 = M4;
filter_create_ext(output_chain, m4, "-gP", 0);
filter_create_ext(output_chain, m4, "-gP", NULL);
filter_create_int(output_chain, filter_fix_linedirs, NULL);
/* For debugging, only run the requested number of filters. */

View File

@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 4 2017 $
.Dd $Mdocdate: August 8 2018 $
.Dt APROPOS 1
.Os
.Sh NAME
@ -74,7 +74,7 @@ would.
If the standard output is a terminal device and
.Fl c
is not specified, use
.Xr more 1
.Xr less 1
to paginate them.
In
.Fl a
@ -334,7 +334,7 @@ Text production:
Any non-empty value of the environment variable
.Ev MANPAGER
is used instead of the standard pagination program,
.Xr more 1 ;
.Xr less 1 ;
see
.Xr man 1
for details.
@ -357,7 +357,7 @@ Specifies the pagination program to use when
.Ev MANPAGER
is not defined.
If neither PAGER nor MANPAGER is defined,
.Xr more 1
.Xr less 1
.Fl s
is used.
Only used if

View File

@ -1119,7 +1119,7 @@ spawn_pager(struct tag_files *tag_files)
if (pager == NULL || *pager == '\0')
pager = getenv("PAGER");
if (pager == NULL || *pager == '\0')
pager = "more -s";
pager = "less -s";
cp = mandoc_strdup(pager);
/*

View File

@ -31,7 +31,7 @@
.\"
.\" @(#)man.1 8.2 (Berkeley) 1/2/94
.\"
.Dd $Mdocdate: May 17 2017 $
.Dd $Mdocdate: August 8 2018 $
.Dt MAN 1
.Os
.Sh NAME
@ -75,7 +75,7 @@ See
for a description of the contents of this file.
.It Fl c
Copy the manual page to the standard output instead of using
.Xr more 1
.Xr less 1
to paginate it.
This is done by default if the standard output is not a terminal device.
.It Fl f
@ -233,7 +233,7 @@ is case insensitive.
Any non-empty value of the environment variable
.Ev MANPAGER
is used instead of the standard pagination program,
.Xr more 1 .
.Xr less 1 .
If
.Xr less 1
is used, the interactive
@ -282,7 +282,7 @@ Specifies the pagination program to use when
.Ev MANPAGER
is not defined.
If neither PAGER nor MANPAGER is defined,
.Xr more 1
.Xr less 1
.Fl s
is used.
Only used if

View File

@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 20 2017 $
.Dd $Mdocdate: August 8 2018 $
.Dt MANDOC 1
.Os
.Sh NAME
@ -54,13 +54,13 @@ The options are as follows:
If the standard output is a terminal device and
.Fl c
is not specified, use
.Xr more 1
.Xr less 1
to paginate the output, just like
.Xr man 1
would.
.It Fl c
Copy the formatted manual pages to the standard output without using
.Xr more 1
.Xr less 1
to paginate them.
This is the default.
It can be specified to override
@ -578,7 +578,7 @@ Meta data is not available in this case.
Any non-empty value of the environment variable
.Ev MANPAGER
is used instead of the standard pagination program,
.Xr more 1 ;
.Xr less 1 ;
see
.Xr man 1
for details.
@ -592,7 +592,7 @@ Specifies the pagination program to use when
.Ev MANPAGER
is not defined.
If neither PAGER nor MANPAGER is defined,
.Xr more 1
.Xr less 1
.Fl s
is used.
Only used if

View File

@ -153,6 +153,12 @@ ATF_TC_HEAD(mutex2, tc)
atf_tc_set_md_var(tc, "timeout", "40");
#endif
#endif
#ifdef __FreeBSD__
#if defined(__riscv)
atf_tc_set_md_var(tc, "timeout", "600");
#endif
#endif
}
ATF_TC_BODY(mutex2, tc)
{
@ -230,6 +236,12 @@ ATF_TC_HEAD(mutex3, tc)
atf_tc_set_md_var(tc, "timeout", "40");
#endif
#endif
#ifdef __FreeBSD__
#if defined(__riscv)
atf_tc_set_md_var(tc, "timeout", "600");
#endif
#endif
}
ATF_TC_BODY(mutex3, tc)
{

View File

@ -189,7 +189,7 @@ enum {
#define GATE_SERVER "" /* default server */
#endif
#define DEFAULTPAGER "more" /* default pager if $PAGER isn't set */
#define DEFAULTPAGER "less" /* default pager if $PAGER isn't set */
#define DEFAULTPROMPT "ftp> " /* default prompt if `set prompt' is empty */
#define DEFAULTRPROMPT "" /* default rprompt if `set rprompt' is empty */

View File

@ -70,14 +70,6 @@ BSM_ETC_DIR= ${DESTDIR}/etc/security
BIN1+= amd.map
.endif
.if ${MK_AUTOFS} != "no"
BIN1+= auto_master
.endif
.if ${MK_FREEBSD_UPDATE} != "no"
BIN1+= freebsd-update.conf
.endif
.if ${MK_FTP} != "no"
BIN1+= ftpusers
.endif
@ -111,10 +103,6 @@ SSH= ${SRCTOP}/crypto/openssh/ssh_config \
SSL= ${SRCTOP}/crypto/openssl/apps/openssl.cnf
.endif
.if ${MK_PORTSNAP} != "no"
BIN1+= portsnap.conf
.endif
.if ${MK_PF} != "no"
BIN1+= pf.os
.endif
@ -198,9 +186,6 @@ distribution:
echo "./var/db/services.db type=file mode=0644 uname=root gname=wheel"; \
) | ${METALOG.add}
.endif
.if ${MK_AUTOFS} != "no"
${_+_}cd ${.CURDIR}/autofs; ${MAKE} install
.endif
.if ${MK_BLUETOOTH} != "no"
${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
.endif
@ -271,8 +256,6 @@ distribution:
${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
${DESTDIR}/var/db/locate.database
.endif
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
${DESTDIR}/var/crash
cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
${FREEBSD} ${DESTDIR}/
.if ${MK_BOOT} != "no"

View File

@ -74,6 +74,8 @@
preserve
..
run
dhclient
..
ppp gname=network mode=0770
..
wpa_supplicant

View File

@ -18,7 +18,7 @@ umask 22
set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin $HOME/bin)
setenv EDITOR vi
setenv PAGER more
setenv PAGER less
setenv BLOCKSIZE K
if ($?prompt) then

View File

@ -6,7 +6,7 @@ HOME=/root
export HOME
TERM=${TERM:-xterm}
export TERM
PAGER=more
PAGER=less
export PAGER
# Query terminal size; useful for serial lines.

View File

@ -206,6 +206,11 @@ time_t posix2time(time_t t);
#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
#include <xlocale/_time.h>
#endif
/* ISO/IEC 9899:201x 7.27.2.5 The timespec_get function */
#define TIME_UTC 1 /* time elapsed since epoch */
int timespec_get(struct timespec *ts, int base);
__END_DECLS
#endif /* !_TIME_H_ */

View File

@ -10,6 +10,9 @@ LLVM_ASM_PARSER(AArch64)
#ifdef LLVM_TARGET_ENABLE_ARM
LLVM_ASM_PARSER(ARM)
#endif
#ifdef LLVM_TARGET_ENABLE_BPF
LLVM_ASM_PARSER(BPF)
#endif
#ifdef LLVM_TARGET_ENABLE_MIPS
LLVM_ASM_PARSER(Mips)
#endif

View File

@ -10,6 +10,9 @@ LLVM_ASM_PRINTER(AArch64)
#ifdef LLVM_TARGET_ENABLE_ARM
LLVM_ASM_PRINTER(ARM)
#endif
#ifdef LLVM_TARGET_ENABLE_BPF
LLVM_ASM_PRINTER(BPF)
#endif
#ifdef LLVM_TARGET_ENABLE_MIPS
LLVM_ASM_PRINTER(Mips)
#endif

View File

@ -10,6 +10,9 @@ LLVM_DISASSEMBLER(AArch64)
#ifdef LLVM_TARGET_ENABLE_ARM
LLVM_DISASSEMBLER(ARM)
#endif
#ifdef LLVM_TARGET_ENABLE_BPF
LLVM_DISASSEMBLER(BPF)
#endif
#ifdef LLVM_TARGET_ENABLE_MIPS
LLVM_DISASSEMBLER(Mips)
#endif

View File

@ -10,6 +10,9 @@ LLVM_TARGET(AArch64)
#ifdef LLVM_TARGET_ENABLE_ARM
LLVM_TARGET(ARM)
#endif
#ifdef LLVM_TARGET_ENABLE_BPF
LLVM_TARGET(BPF)
#endif
#ifdef LLVM_TARGET_ENABLE_MIPS
LLVM_TARGET(Mips)
#endif

View File

@ -9,14 +9,15 @@ INTERNALLIB=
CFLAGS+= -I${.OBJDIR}
.if ${MK_LLVM_TARGET_AARCH64} == "no" && ${MK_LLVM_TARGET_ARM} == "no" && \
${MK_LLVM_TARGET_MIPS} == "no" && ${MK_LLVM_TARGET_POWERPC} == "no" && \
${MK_LLVM_TARGET_SPARC} == "no" && ${MK_LLVM_TARGET_X86} == "no"
${MK_LLVM_TARGET_BPF} == "no" && ${MK_LLVM_TARGET_MIPS} == "no" && \
${MK_LLVM_TARGET_POWERPC} == "no" && ${MK_LLVM_TARGET_SPARC} == "no" && \
${MK_LLVM_TARGET_X86} == "no"
.error Please enable at least one of: MK_LLVM_TARGET_AARCH64,\
MK_LLVM_TARGET_ARM, MK_LLVM_TARGET_MIPS, MK_LLVM_TARGET_POWERPC,\
MK_LLVM_TARGET_SPARC, or MK_LLVM_TARGET_X86
MK_LLVM_TARGET_ARM, MK_LLVM_TARGET_BPF, MK_LLVM_TARGET_MIPS, \
MK_LLVM_TARGET_POWERPC, MK_LLVM_TARGET_SPARC, or MK_LLVM_TARGET_X86
.endif
.for arch in AArch64 ARM Mips PowerPC Sparc X86
.for arch in AArch64 ARM BPF Mips PowerPC Sparc X86
. if ${MK_LLVM_TARGET_${arch:tu}} != "no"
CFLAGS+= -I${LLVM_SRCS}/lib/Target/${arch}
. endif
@ -941,6 +942,27 @@ SRCS_MIN+= Target/ARM/Thumb2SizeReduction.cpp
SRCS_MIN+= Target/ARM/ThumbRegisterInfo.cpp
SRCS_MIN+= Target/ARM/Utils/ARMBaseInfo.cpp
.endif # MK_LLVM_TARGET_ARM
.if ${MK_LLVM_TARGET_BPF} != "no"
SRCS_MIN+= Target/BPF/AsmParser/BPFAsmParser.cpp
SRCS_MIN+= Target/BPF/BPFAsmPrinter.cpp
SRCS_MIN+= Target/BPF/BPFFrameLowering.cpp
SRCS_MIN+= Target/BPF/BPFISelDAGToDAG.cpp
SRCS_MIN+= Target/BPF/BPFISelLowering.cpp
SRCS_MIN+= Target/BPF/BPFInstrInfo.cpp
SRCS_MIN+= Target/BPF/BPFMCInstLower.cpp
SRCS_MIN+= Target/BPF/BPFMIPeephole.cpp
SRCS_MIN+= Target/BPF/BPFRegisterInfo.cpp
SRCS_MIN+= Target/BPF/BPFSelectionDAGInfo.cpp
SRCS_MIN+= Target/BPF/BPFSubtarget.cpp
SRCS_MIN+= Target/BPF/BPFTargetMachine.cpp
SRCS_MIN+= Target/BPF/Disassembler/BPFDisassembler.cpp
SRCS_MIN+= Target/BPF/InstPrinter/BPFInstPrinter.cpp
SRCS_MIN+= Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
SRCS_MIN+= Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp
SRCS_MIN+= Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp
SRCS_MIN+= Target/BPF/MCTargetDesc/BPFMCTargetDesc.cpp
SRCS_MIN+= Target/BPF/TargetInfo/BPFTargetInfo.cpp
.endif # MK_LLVM_TARGET_BPF
.if ${MK_LLVM_TARGET_MIPS} != "no"
SRCS_MIN+= Target/Mips/AsmParser/MipsAsmParser.cpp
SRCS_XDW+= Target/Mips/Disassembler/MipsDisassembler.cpp
@ -1442,7 +1464,7 @@ beforebuild:
# Note: some rules are superfluous, not every combination is valid.
.for arch in \
AArch64/AArch64 ARM/ARM Mips/Mips PowerPC/PPC Sparc/Sparc X86/X86
AArch64/AArch64 ARM/ARM BPF/BPF Mips/Mips PowerPC/PPC Sparc/Sparc X86/X86
. for hdr in \
AsmMatcher/-gen-asm-matcher \
AsmWriter1/-gen-asm-writer,-asmwriternum=1 \
@ -1502,6 +1524,17 @@ TGHDRS+= ARMGenRegisterInfo.inc
TGHDRS+= ARMGenSubtargetInfo.inc
TGHDRS+= ARMGenSystemRegister.inc
.endif # MK_LLVM_TARGET_ARM
.if ${MK_LLVM_TARGET_BPF} != "no"
TGHDRS+= BPFGenAsmMatcher.inc
TGHDRS+= BPFGenAsmWriter.inc
TGHDRS+= BPFGenCallingConv.inc
TGHDRS+= BPFGenDAGISel.inc
TGHDRS+= BPFGenDisassemblerTables.inc
TGHDRS+= BPFGenInstrInfo.inc
TGHDRS+= BPFGenMCCodeEmitter.inc
TGHDRS+= BPFGenRegisterInfo.inc
TGHDRS+= BPFGenSubtargetInfo.inc
.endif # MK_LLVM_TARGET_BPF
.if ${MK_LLVM_TARGET_MIPS} != "no"
TGHDRS+= MipsGenAsmMatcher.inc
TGHDRS+= MipsGenAsmWriter.inc

View File

@ -54,6 +54,9 @@ CFLAGS+= -DLLVM_TARGET_ENABLE_ARM
LLVM_NATIVE_ARCH= ARM
. endif
.endif
.if ${MK_LLVM_TARGET_BPF} != "no"
CFLAGS+= -DLLVM_TARGET_ENABLE_BPF
.endif
.if ${MK_LLVM_TARGET_MIPS} != "no"
CFLAGS+= -DLLVM_TARGET_ENABLE_MIPS
. if ${MACHINE_CPUARCH} == "mips"

View File

@ -135,6 +135,7 @@ SRCS+= __getosreldate.c \
termios.c \
time.c \
times.c \
timespec_get.c \
timezone.c \
tls.c \
ttyname.c \
@ -299,6 +300,7 @@ MAN+= alarm.3 \
tcsetsid.3 \
time.3 \
times.3 \
timespec_get.3 \
timezone.3 \
ttyname.3 \
tzset.3 \

Some files were not shown because too many files have changed in this diff Show More