]> git.draconx.ca Git - cdecl99.git/blob - t/installcheck.c
Port to use getline.h from dxcommon.
[cdecl99.git] / t / installcheck.c
1 /*
2  * Post-installation sanity check for libcdecl.
3  *
4  * Copyright © 2023 Nick Bowler
5  *
6  * This program 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 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.
18  */
19
20 /* Define configuration macros used in cdecl.h to expand to syntax errors. */
21 #define HAVE__BOOL (0xdeadc0de * "HAVE__BOOL")
22
23 #include <cdecl.h>
24
25 int main(void)
26 {
27         extern int puts(const char *);
28
29         struct cdecl_declarator decl_array, decl_null = {0};
30         struct cdecl_declspec spec = {0, CDECL_TYPE_INT};
31         struct cdecl decl = {0, &spec, &decl_array};
32         char buf[100];
33
34         decl_array.child = &decl_null;
35         decl_array.type = CDECL_DECL_ARRAY;
36         decl_array.u.array.length = 1234567890;
37         decl_array.u.array.vla = NULL;
38
39         cdecl_explain(buf, sizeof buf, &decl);
40         puts(buf);
41 }