483f128b428ed871ee506d9ee8dfa3e45a0b64b8
[platform/core/appfw/xdgmime.git] / test / xdgmime_test.c
1 /*
2  * xdgmime_test.c
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jayoun Lee                          <airjany@samsung.com>
7  * Contact: Seokkyu Jang                        <seokkyu.jang@samsung.com>
8  * Contact: Sangil Yoon                         <si83.yoon@samsung.com>
9  *
10  * This library is free software; you can redistribute it and/or modify it under
11  * the terms of the GNU Lesser General Public License as published by the
12  * Free Software Foundation; either version 2.1 of the License, or (at your option)
13  * any later version.
14  *
15  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
16  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
17  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18  * License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this library; if not, write to the Free Software Foundation, Inc., 51
22  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25
26 #include <stdio.h>
27 #include "xdgmime/src/xdgmime.h"
28
29 #define PERF_ACTIVATE
30 #include "perf.h"
31
32 int main(int argc, char** argv)
33 {
34         const char* res;
35         if(argc < 2){
36                 printf("[usage] %s <filename> or <mimetype>\n",argv[0]);
37                 exit(0);
38         }
39
40         printf("unaliased = %s\n",xdg_mime_unalias_mime_type(argv[1]));
41
42         INIT_PERF("start");
43         res = xdg_mime_get_mime_type_for_file(argv[1],NULL);
44         if(strcmp(res,"application/octet-stream")==0)
45                 res = xdg_mime_get_mime_type_from_file_name(argv[1]);
46         PERF("end");
47         printf("%s has a mime-type of %s\n", argv[1], res);
48
49         return 0;
50 }
51
52 /* vi: set ts=8 sts=8 sw=8: */