diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-01-12 14:55:02 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-01-12 14:55:02 +0000 |
commit | 3d4e8889889e5e36302454225999f7e146d3219c (patch) | |
tree | fa315b999f531039df54ab7af8e99f7e8daad77c /gnu/lib/libodialog/TESTS/tree.c | |
parent | b905920a72950a63c9782b4911d252bfac08db6e (diff) | |
download | FreeBSD-src-3d4e8889889e5e36302454225999f7e146d3219c.zip FreeBSD-src-3d4e8889889e5e36302454225999f7e146d3219c.tar.gz |
Update dialog to version 20100428. This changes the license under which
dialog is distributed from GPLv2 to LGPLv2 and introduces a number of new
features and a new and better libdialog API. The existing libdialog will
be kept temporarily as libodialog for compatibility purposes until sade,
sysinstall and tzsetup have been either updated or replaced.
__FreeBSD_version is now 900030.
Discussed on: -current
Approved by: core
Obtained from: http://invisible-island.net/dialog
Diffstat (limited to 'gnu/lib/libodialog/TESTS/tree.c')
-rw-r--r-- | gnu/lib/libodialog/TESTS/tree.c | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/gnu/lib/libodialog/TESTS/tree.c b/gnu/lib/libodialog/TESTS/tree.c new file mode 100644 index 0000000..c69b52e --- /dev/null +++ b/gnu/lib/libodialog/TESTS/tree.c @@ -0,0 +1,111 @@ +/* + * tree.c + * + * small test-driver for new dialog functionality + * + * Copyright (c) 1998, Anatoly A. Orehovsky + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <stdio.h> +#include <stdlib.h> +#include <dialog.h> + +unsigned char *names[] = { + "/", + "/dev", + "/dev/fd", + "/tmp", + "/usr", + "/var", + "/home", + "/stand", + "/stand/etc", + "/stand/en_US.ISO8859-1", + "/stand/info", + "/stand/info/bin", + "/stand/info/des", + "/stand/info/games", + "/stand/info/manpages", + "/stand/info/proflibs", + "/stand/info/dict", + "/stand/info/info", + "/stand/info/src", + "/etc", + "/etc/gnats", + "/etc/kerberosIV", + "/etc/mtree", + "/etc/namedb", + "/etc/ppp", + "/etc/uucp", + "/etc/sliphome", + "/proc", + "/lkm", + "/mnt", + "/root", + "/sbin", + "/bin", + 0 +}; + +unsigned char *names1[] = { + "a", + "a:b", + "a:b:c", + "a:d" +}; + +int +main(int argc, char **argv) +{ + int retval; + unsigned char *tresult; + char comstr[BUFSIZ]; + + init_dialog(); + do { + use_helpline("Press OK for listing directory"); + retval = dialog_tree(names, + sizeof(names)/sizeof(unsigned char *) - 1, + '/', + "tree dialog box example", + "Typical find -x / -type d output", + -1, -1, 15, + &tresult); + + if (retval) + break; + + use_helpline(NULL); + (void)snprintf(comstr, sizeof(comstr), + "ls -CF %s", tresult); + + retval = dialog_prgbox( + comstr, + comstr, 20, 60, TRUE, TRUE); + + dialog_clear(); + + retval = dialog_tree(names1, + sizeof(names1)/sizeof(unsigned char *), + ':', + "tree dialog box example", + "Other tree", + -1, -1, 5, + &tresult); + if (!retval) + { + dialog_clear(); + } + } while (!retval); + + dialog_update(); + + dialog_clear(); + + end_dialog(); + + exit(retval); +} |