From: Philippe Antoine Date: Wed, 22 Jan 2020 08:33:05 +0000 (+0100) Subject: init: move main to a separate file X-Git-Tag: suricata-6.0.0-beta1~744 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af2a689a9932c658f1fd47b348010b0bf708c482;p=thirdparty%2Fsuricata.git init: move main to a separate file so as to reuse code from suricata.c with fuzz targets --- diff --git a/src/Makefile.am b/src/Makefile.am index e755556b4d..f1ed914752 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -321,6 +321,7 @@ log-stats.c log-stats.h \ log-tcp-data.c log-tcp-data.h \ log-tlslog.c log-tlslog.h \ log-tlsstore.c log-tlsstore.h \ +main.c \ output.c output.h \ output-file.c output-file.h \ output-filedata.c output-filedata.h \ diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000000..05c9276b4b --- /dev/null +++ b/src/main.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2020 Open Information Security Foundation + * + * You can copy, redistribute or modify this Program under the terms of + * the GNU General Public License version 2 as published by the Free + * Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * version 2 along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#include "suricata.h" + +int main(int argc, char **argv) +{ + return SuricataMain(argc, argv); +} diff --git a/src/suricata.c b/src/suricata.c index fc43fe7809..8489c1cea3 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2014 Open Information Security Foundation +/* Copyright (C) 2007-2020 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free @@ -2980,7 +2980,7 @@ int InitGlobal(void) { return 0; } -int main(int argc, char **argv) +int SuricataMain(int argc, char **argv) { SCInstanceInit(&suricata, argv[0]); diff --git a/src/suricata.h b/src/suricata.h index f61d6c89ad..1b4111610b 100644 --- a/src/suricata.h +++ b/src/suricata.h @@ -188,6 +188,7 @@ int SuriHasSigFile(void); extern int run_mode; +int SuricataMain(int argc, char **argv); int InitGlobal(void); int PostConfLoadedSetup(SCInstance *suri);