]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - gnu/lib/libodialog/TESTS/tree.c
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / gnu / lib / libodialog / TESTS / tree.c
1 /*
2  * tree.c
3  *
4  * small test-driver for new dialog functionality
5  *
6  * Copyright (c) 1998, Anatoly A. Orehovsky
7  */
8
9 #include <sys/cdefs.h>
10 __FBSDID("$FreeBSD$");
11
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <dialog.h>
15
16 unsigned char *names[] = {
17         "/",
18         "/dev",
19         "/dev/fd",
20         "/tmp",
21         "/usr",
22         "/var",
23         "/home",
24         "/stand",
25         "/stand/etc",
26         "/stand/en_US.ISO8859-1",
27         "/stand/info",
28         "/stand/info/bin",
29         "/stand/info/des",
30         "/stand/info/games",
31         "/stand/info/manpages",
32         "/stand/info/proflibs",
33         "/stand/info/dict",
34         "/stand/info/info",
35         "/stand/info/src",
36         "/etc",
37         "/etc/gnats",
38         "/etc/kerberosIV",
39         "/etc/mtree",
40         "/etc/namedb",
41         "/etc/ppp",
42         "/etc/uucp",
43         "/etc/sliphome",
44         "/proc",
45         "/lkm",
46         "/mnt",
47         "/root",
48         "/sbin",
49         "/bin",
50         0
51 };
52
53 unsigned char *names1[] = {
54         "a",
55         "a:b",
56         "a:b:c",
57         "a:d"
58 };
59
60 int
61 main(int argc, char **argv)
62 {
63         int retval;
64         unsigned char *tresult;
65         char comstr[BUFSIZ];
66
67         init_dialog();
68         do {
69                 use_helpline("Press OK for listing directory");
70                 retval = dialog_tree(names, 
71                         sizeof(names)/sizeof(unsigned char *) - 1,
72                          '/',
73                         "tree dialog box example",
74                         "Typical find -x / -type d output", 
75                         -1, -1, 15,
76                                     &tresult);
77                 
78                 if (retval)
79                         break;
80                 
81                 use_helpline(NULL);
82                 (void)snprintf(comstr, sizeof(comstr), 
83                         "ls -CF %s", tresult);
84
85                 retval = dialog_prgbox(
86                         comstr, 
87                         comstr, 20, 60, TRUE, TRUE);
88
89                 dialog_clear();
90                 
91                 retval = dialog_tree(names1, 
92                         sizeof(names1)/sizeof(unsigned char *),
93                          ':',
94                         "tree dialog box example",
95                         "Other tree", 
96                         -1, -1, 5,
97                                     &tresult);
98                 if (!retval)
99                 {
100                         dialog_clear();
101                 }
102         } while (!retval);
103
104         dialog_update();
105         
106         dialog_clear();
107         
108         end_dialog();
109         
110         exit(retval);
111 }