| 1 | // Copyright (C) 2006-2009 by Tor Andersson. |
| 2 | // Copyright (C) 2023 by Adrian Welcker. |
| 3 | // |
| 4 | // This file is part of Gargoyle. |
| 5 | // |
| 6 | // Gargoyle is free software; you can redistribute it and/or modify |
| 7 | // it under the terms of the GNU General Public License as published by |
| 8 | // the Free Software Foundation; either version 2 of the License, or |
| 9 | // (at your option) any later version. |
| 10 | // |
| 11 | // Gargoyle is distributed in the hope that it will be useful, |
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | // GNU General Public License for more details. |
| 15 | // |
| 16 | // You should have received a copy of the GNU General Public License |
| 17 | // along with Gargoyle; if not, write to the Free Software |
| 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | |
| 20 | #include <stdlib.h> |
| 21 | #include <string.h> |
| 22 | |
| 23 | #include "glk.h" |
| 24 | #include "glkstart.h" |
| 25 | |
| 26 | int main(int argc, char *argv[]) |
| 27 | { |
| 28 | garglk_startup(argc, argv); |
| 29 | |
| 30 | glkunix_startup_t startdata; |
| 31 | startdata.argc = argc; |
| 32 | startdata.argv = malloc((argc + 1) * sizeof(char *)); |
| 33 | memcpy(startdata.argv, argv, (argc + 1) * sizeof(char *)); |
| 34 | |
| 35 | if (!glkunix_startup_code(&startdata)) { |
| 36 | glk_exit(); |
| 37 | } |
| 38 | |
| 39 | glk_main(); |
| 40 | glk_exit(); |
| 41 | |
| 42 | return 0; |
| 43 | } |