Add examples for tree functions.

Submitted by:	"Anatoly A. Orehovsky" <tolik@mpeks.tomsk.su>
This commit is contained in:
jkh 1998-09-29 12:22:46 +00:00
parent 2447cf8621
commit 8064cb05e7
6 changed files with 346 additions and 2 deletions

View File

@ -1,9 +1,10 @@
# Really quick and evil Makefile for building all the tests. I wish that bmake was friendlier to
# the concept of multiple progs/libs in the same directory.
# $Id$
# $Id: Makefile,v 1.7 1997/02/22 15:42:37 peter Exp $
PROGS= msg yesno prgbox gauge dselect fselect text menu1 menu2 menu3 \
input1 input2 check1 check2 check3 radio1 radio2 radio3
input1 input2 check1 check2 check3 radio1 radio2 radio3 \
ftree1 ftree2 tree
CFLAGS+= -Wall -Wstrict-prototypes
LDFLAGS += -ldialog -lncurses -lmytinfo

View File

@ -0,0 +1,43 @@
/*
* ftree1.c
*
* small test-driver for new dialog functionality
*
* Copyright (c) 1998, Anatoly A. Orehovsky
*
* file ./ftree1.test with xterm widget tree from
* direct editres(1) dump needed !!!
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <dialog.h>
int
main(int argc, unsigned char *argv[])
{
int retval;
unsigned char *tresult;
init_dialog();
retval = dialog_ftree("ftree1.test", '\t',
"ftree dialog box example",
"xterm widget tree from direct editres(1) dump",
-1, -1, 15,
&tresult);
dialog_update();
dialog_clear();
end_dialog();
if (!retval)
{
puts(tresult);
free(tresult);
}
exit(retval);
}

View File

@ -0,0 +1,73 @@
XTerm login
VendorShellExt shellext
VT100 vt100
SimpleMenu fontMenu
SmeBSB menuLabel
SmeBSB fontdefault
SmeBSB font1
SmeBSB font2
SmeBSB font3
SmeBSB font4
SmeBSB font5
SmeBSB font6
SmeBSB fontescape
SmeBSB fontsel
SimpleMenu mainMenu
SmeBSB menuLabel
SmeBSB securekbd
SmeBSB allowsends
SmeBSB redraw
SmeLine line1
SmeBSB 8-bit control
SmeBSB sun function-keys
SmeLine line2
SmeBSB suspend
SmeBSB continue
SmeBSB interrupt
SmeBSB hangup
SmeBSB terminate
SmeBSB kill
SmeLine line3
SmeBSB quit
SimpleMenu vtMenu
SmeBSB menuLabel
SmeBSB scrollbar
SmeBSB jumpscroll
SmeBSB reversevideo
SmeBSB autowrap
SmeBSB reversewrap
SmeBSB autolinefeed
SmeBSB appcursor
SmeBSB appkeypad
SmeBSB scrollkey
SmeBSB scrollttyoutput
SmeBSB allow132
SmeBSB cursesemul
SmeBSB visualbell
SmeBSB marginbell
SmeBSB altscreen
SmeLine line1
SmeBSB softreset
SmeBSB hardreset
SmeBSB clearsavedlines
SmeLine line2
SmeBSB tekshow
SmeBSB tekmode
SmeBSB vthide
TopLevelShell tektronix
VendorShellExt shellext
Tek4014 tek4014
SimpleMenu tekMenu
SmeBSB menuLabel
SmeBSB tektextlarge
SmeBSB tektext2
SmeBSB tektext3
SmeBSB tektextsmall
SmeLine line1
SmeBSB tekpage
SmeBSB tekreset
SmeBSB tekcopy
SmeLine line2
SmeBSB vtshow
SmeBSB vtmode
SmeBSB tekhide

View File

@ -0,0 +1,45 @@
/*
* ftree2.c
*
* small test-driver for new dialog functionality
*
* Copyright (c) 1998, Anatoly A. Orehovsky
*
* file ./ftree2.test with xterm widget tree from
* preprocess editres(1) dump needed !!!
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <dialog.h>
int
main(int argc, unsigned char *argv[])
{
int retval;
unsigned char *tresult;
init_dialog();
use_helpfile("ftree2.test");
use_helpline("Press Arrows, Tab, Enter or F1");
retval = dialog_ftree("ftree2.test", '\t',
"ftree dialog box example",
"xterm widget tree from preprocess editres(1) dump",
-1, -1, 15,
&tresult);
dialog_update();
dialog_clear();
end_dialog();
if (!retval)
{
puts(tresult);
free(tresult);
}
exit(retval);
}

View File

@ -0,0 +1,73 @@
XTerm login
XTerm login VendorShellExt shellext
XTerm login VT100 vt100
XTerm login SimpleMenu fontMenu
XTerm login SimpleMenu fontMenu SmeBSB menuLabel
XTerm login SimpleMenu fontMenu SmeBSB fontdefault
XTerm login SimpleMenu fontMenu SmeBSB font1
XTerm login SimpleMenu fontMenu SmeBSB font2
XTerm login SimpleMenu fontMenu SmeBSB font3
XTerm login SimpleMenu fontMenu SmeBSB font4
XTerm login SimpleMenu fontMenu SmeBSB font5
XTerm login SimpleMenu fontMenu SmeBSB font6
XTerm login SimpleMenu fontMenu SmeBSB fontescape
XTerm login SimpleMenu fontMenu SmeBSB fontsel
XTerm login SimpleMenu mainMenu
XTerm login SimpleMenu mainMenu SmeBSB menuLabel
XTerm login SimpleMenu mainMenu SmeBSB securekbd
XTerm login SimpleMenu mainMenu SmeBSB allowsends
XTerm login SimpleMenu mainMenu SmeBSB redraw
XTerm login SimpleMenu mainMenu SmeLine line1
XTerm login SimpleMenu mainMenu SmeBSB 8-bit control
XTerm login SimpleMenu mainMenu SmeBSB sun function-keys
XTerm login SimpleMenu mainMenu SmeLine line2
XTerm login SimpleMenu mainMenu SmeBSB suspend
XTerm login SimpleMenu mainMenu SmeBSB continue
XTerm login SimpleMenu mainMenu SmeBSB interrupt
XTerm login SimpleMenu mainMenu SmeBSB hangup
XTerm login SimpleMenu mainMenu SmeBSB terminate
XTerm login SimpleMenu mainMenu SmeBSB kill
XTerm login SimpleMenu mainMenu SmeLine line3
XTerm login SimpleMenu mainMenu SmeBSB quit
XTerm login SimpleMenu vtMenu
XTerm login SimpleMenu vtMenu SmeBSB menuLabel
XTerm login SimpleMenu vtMenu SmeBSB scrollbar
XTerm login SimpleMenu vtMenu SmeBSB jumpscroll
XTerm login SimpleMenu vtMenu SmeBSB reversevideo
XTerm login SimpleMenu vtMenu SmeBSB autowrap
XTerm login SimpleMenu vtMenu SmeBSB reversewrap
XTerm login SimpleMenu vtMenu SmeBSB autolinefeed
XTerm login SimpleMenu vtMenu SmeBSB appcursor
XTerm login SimpleMenu vtMenu SmeBSB appkeypad
XTerm login SimpleMenu vtMenu SmeBSB scrollkey
XTerm login SimpleMenu vtMenu SmeBSB scrollttyoutput
XTerm login SimpleMenu vtMenu SmeBSB allow132
XTerm login SimpleMenu vtMenu SmeBSB cursesemul
XTerm login SimpleMenu vtMenu SmeBSB visualbell
XTerm login SimpleMenu vtMenu SmeBSB marginbell
XTerm login SimpleMenu vtMenu SmeBSB altscreen
XTerm login SimpleMenu vtMenu SmeLine line1
XTerm login SimpleMenu vtMenu SmeBSB softreset
XTerm login SimpleMenu vtMenu SmeBSB hardreset
XTerm login SimpleMenu vtMenu SmeBSB clearsavedlines
XTerm login SimpleMenu vtMenu SmeLine line2
XTerm login SimpleMenu vtMenu SmeBSB tekshow
XTerm login SimpleMenu vtMenu SmeBSB tekmode
XTerm login SimpleMenu vtMenu SmeBSB vthide
XTerm login TopLevelShell tektronix
XTerm login TopLevelShell tektronix VendorShellExt shellext
XTerm login TopLevelShell tektronix Tek4014 tek4014
XTerm login SimpleMenu tekMenu
XTerm login SimpleMenu tekMenu SmeBSB menuLabel
XTerm login SimpleMenu tekMenu SmeBSB tektextlarge
XTerm login SimpleMenu tekMenu SmeBSB tektext2
XTerm login SimpleMenu tekMenu SmeBSB tektext3
XTerm login SimpleMenu tekMenu SmeBSB tektextsmall
XTerm login SimpleMenu tekMenu SmeLine line1
XTerm login SimpleMenu tekMenu SmeBSB tekpage
XTerm login SimpleMenu tekMenu SmeBSB tekreset
XTerm login SimpleMenu tekMenu SmeBSB tekcopy
XTerm login SimpleMenu tekMenu SmeLine line2
XTerm login SimpleMenu tekMenu SmeBSB vtshow
XTerm login SimpleMenu tekMenu SmeBSB vtmode
XTerm login SimpleMenu tekMenu SmeBSB tekhide

View File

@ -0,0 +1,109 @@
/*
* tree.c
*
* small test-driver for new dialog functionality
*
* Copyright (c) 1998, Anatoly A. Orehovsky
*
*/
#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, unsigned 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);
}