"Fossies" - the Fresh Open Source Software Archive 
Member "libextractor-1.11/src/main/test_plugin_loading.c" (30 Jan 2021, 2034 Bytes) of package /linux/privat/libextractor-1.11.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the latest
Fossies "Diffs" side-by-side code changes report for "test_plugin_loading.c":
1.10_vs_1.11.
1 /*
2 This file is part of libextractor.
3 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009 Vidyut Samanta and Christian Grothoff
4
5 libextractor is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 libextractor is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with libextractor; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19 */
20
21 /**
22 * @file main/test_plugin_loading.c
23 * @brief testcase for dynamic loading and unloading of plugins
24 */
25 #include "platform.h"
26 #include "extractor.h"
27
28 int
29 main (int argc, char *argv[])
30 {
31 struct EXTRACTOR_PluginList *arg;
32
33 /* change environment to find 'extractor_test' plugin which is
34 not installed but should be in the current directory (or .libs)
35 on 'make check' */
36 if (0 != putenv ("LIBEXTRACTOR_PREFIX=.:.libs/"))
37 fprintf (stderr,
38 "Failed to update my environment, plugin loading may fail: %s\n",
39 strerror (errno));
40
41 /* do some load/unload tests */
42 arg = EXTRACTOR_plugin_add (NULL, "test", NULL,
43 EXTRACTOR_OPTION_DEFAULT_POLICY);
44 if (arg != EXTRACTOR_plugin_add (arg, "test", NULL,
45 EXTRACTOR_OPTION_DEFAULT_POLICY))
46 {
47 fprintf (stderr,
48 "Could load plugin twice, that should not be allowed\n");
49 }
50 arg = EXTRACTOR_plugin_remove (arg, "test");
51 if (NULL != arg)
52 {
53 fprintf (stderr,
54 "add-remove test failed!\n");
55 return -1;
56 }
57 return 0;
58 }
59
60
61 /* end of test_plugin_loading.c */