1 |
/* |
2 |
* selfext.c -- self-extracting archive runtime |
3 |
* |
4 |
* This file is part of the UAR project. |
5 |
* Copyright (C) 2024 OSN, Inc. |
6 |
* |
7 |
* This program is free software: you can redistribute it and/or modify |
8 |
* it under the terms of the GNU General Public License as published by |
9 |
* the Free Software Foundation, either version 3 of the License, or |
10 |
* (at your option) any later version. |
11 |
* |
12 |
* This program is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 |
*/ |
20 |
|
21 |
#ifdef HAVE_PLIBC |
22 |
# include <plibc/errno.h> |
23 |
# include <plibc/stdio.h> |
24 |
# include <plibc/stdlib.h> |
25 |
# include <plibc/string.h> |
26 |
# include <plibc/unistd.h> |
27 |
#else |
28 |
# include <errno.h> |
29 |
# include <stdio.h> |
30 |
# include <stdlib.h> |
31 |
# include <string.h> |
32 |
# include <unistd.h> |
33 |
#endif |
34 |
|
35 |
#include "uar.h" |
36 |
|
37 |
extern long long int __uar_data_size; |
38 |
extern unsigned char *uar_get_data_start (void); |
39 |
|
40 |
void |
41 |
uar_init () |
42 |
{ |
43 |
} |
44 |
|
45 |
void |
46 |
uar_deinit () |
47 |
{ |
48 |
} |
49 |
|
50 |
void |
51 |
test () |
52 |
{ |
53 |
fwrite ("exits\n", 6, 1, stderr); |
54 |
} |
55 |
|
56 |
int |
57 |
uar_main () |
58 |
{ |
59 |
// printf ("Starting self-extracting archive...\n"); |
60 |
atexit (&test); |
61 |
fwrite ("Starting self-extracting archive...\n", 36, 1, stderr); |
62 |
exit (EXIT_SUCCESS); |
63 |
return 0; |
64 |
} |