|
|
1.1 root 1: /*** ds.c - Display Subdirectories
2: *
3: * Display subdirectories in tree form. This example paints a directory
4: * tree on the screen using VIO calls. USER=drive:path must be in the
5: * enviornment. It determines where the initialization file is kept. The
6: * first time this program is called, it creates a new initialization file
7: * and builds the display tree from the current directory.
8: *
1.1.1.2 ! root 9: *
! 10: * Created by Microsoft Corp. 1986
1.1 root 11: */
12:
13: #include <stdio.h>
14: #include "ds.h"
15: #include "vars.h"
16:
17: extern buildTree (Directory *, char *);
18: extern decorateTree (Directory *);
19: extern clearBottomLine ();
20: extern clearScreen();
21: extern fileInit ();
22: extern getState ();
23: extern handleDisplay (Directory *);
24: extern helpInit ();
25: extern optionInit ();
26: extern refreshDisplay (int, Directory *);
27: extern saveState ();
28: extern screenInit ();
29:
30: /*** main - entry point to DS program
31: *
32: *
33: */
34: main (argc,argv,envp)
35: int argc;
1.1.1.2 ! root 36: NPCH argv[];
! 37: NPCH envp[];
1.1 root 38: {
39: initialize ();
40: if (root->d_child) { /* There is a tree to display */
41: decorateTree (root);
42: handleDisplay (root);
43: }
44: else { /* No tree */
1.1.1.2 ! root 45: VioSetCurPos (WINDOW_TOP+2,0, VioHandle); /* Avoid scrolling error */
1.1 root 46: fprintf (stderr, "\nNo subdirectories in this directory.\n");
47: exitError (2);
48: }
49: if (stateModified)
50: saveState (); /* Save colors */
51: cleanUp ();
52: } /* main */
53:
54:
55: /*** initialize - initialize components of DS program
56: *
57: *
58: */
59: initialize ()
60: {
61: int rCode;
62:
63: fileInit (); /* Init path and file stuff */
64: screenInit (); /* Init the physical screen */
65: helpInit (); /* Initialize help screen */
66: optionInit (); /* Initialize option screen */
67: rCode = getState (); /* Read initialization file */
68: clearScreen (); /* Clear screen */
69: refreshDisplay (-1, NULL); /* Display screen header */
70: if (!rCode) { /* Init file bad */
71: newDir (&root,"\0",0); /* Make root node */
72: buildTree (root,IntRootPath); /* Build directory tree */
73: stateModified = TRUE;
74: }
75: else
76: stateModified = FALSE;
77: return;
78:
79: } /* initialize */
80:
81:
82:
83: /*** exitError - clean up and exit with error code
84: *
85: *
86: */
87: exitError (code)
88: int code;
89: {
90: cleanUp ();
91: exit (code);
92: } /* exitError */
93:
94:
95: /*** cleanUp - clean up before exit
96: *
97: *
98: */
99: cleanUp ()
100: {
101: clearBottomLine (); /* Don't leave garbage if using vt52.sys */
102: } /* cleanUpUp */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.