1 /** media-magic.h -- file/libmagic file analysis
3 * Copyright (C) 2007 Sebastian Freundt
5 * This file is part of SXEmacs.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the author nor the names of any contributors
19 * may be used to endorse or promote products derived from this
20 * software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 /* Synched up with: Not in FSF. */
42 #include "media-magic.h"
46 /* just a dummy declaration */
47 void magic_process(magic_t magic, const char *inname);
50 magic_process(magic_t magic, const char *inname)
54 magic = magic_open(0);
56 fprintf(stderr, "ERROR\n");
59 if (magic_load(magic, "/usr/local/share/file/magic") == -1) {
60 fprintf(stderr, "magic: %s\n", magic_error(magic));
64 type = magic_file(magic, inname);
66 fprintf(stderr, "ERROR: %s\n", magic_error(magic));
68 fprintf(stderr, "%s\n", type);
73 /* media-magic.c ends here */