1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2
/*********************************************************************************
4
* Copyright © 2014 Andrew Smith (GNA SERVICES INC)<Andrew@GNAServicesInc.com>
7
* This file, vaq_magic.c, is part of Vaquita.
9
* Vaquita is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation, either version 3 of the License, or
12
* (at your option) any later version.
14
* Vaquita is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with tpad. If not, see <http://www.gnu.org/licenses/>.
21
********************************************************************************/
24
gint check_magic(gchar* file) {
26
gchar *actual_file = (gchar*) file;
27
const gchar *magic_full;
29
magic_cookie = magic_open(MAGIC_MIME);
30
if (magic_cookie == NULL) {
34
if (magic_load(magic_cookie, NULL) != 0) {
35
magic_close(magic_cookie);
38
magic_full = magic_file(magic_cookie, actual_file);
39
gchar* magic_string= (gchar*) magic_full;
41
if(vaq_magic_test(magic_string,"audio") == 0) ret =1;
49
gint vaq_magic_test (gchar file_mime_string[], gchar check_mime_string[]){
51
unsigned int slen=strlen(check_mime_string);
52
gchar beg_string[slen];
53
strncpy ( beg_string, file_mime_string, (int)slen );
54
if(strncmp(beg_string,check_mime_string,slen) == 0) return(0);
b'\\ No newline at end of file'