home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a070 / 1.ddi / FOXPRO / ADDUSER.PRG next >
Encoding:
Text File  |  1990-02-09  |  21.8 KB  |  714 lines

  1. *********************************************************************
  2. * ADDUSER - This program should be run for each work station that    *
  3. * is attached to your FoxPro multi-user system.  It enables each    *
  4. * individual work station to be optimally configured for providing     *
  5. * the best performance.                                                *
  6. *********************************************************************
  7.  
  8. * Do setup and initialization
  9.  
  10. ON ERROR DO abort
  11. CREATE VIEW adduser
  12. DO cleanup
  13. PUBLIC keyword[6], loc[6], totopts, bootdisk, savedir, cr, success, maxpath
  14. PUBLIC defdir
  15. DO setup
  16.  
  17. * Here's the interactive part
  18.  
  19. IF proceed()
  20.     IF config()
  21.         FOR option = 1 TO totopts
  22.             loc[option] = ALLTRIM(loc[option])
  23.         ENDFOR
  24.         IF bootdisk = 'A' .OR. bootdisk = 'B'
  25.             DO floppy
  26.         ENDIF
  27.         success = autoexec()
  28.         IF success
  29.             success = config_fp()
  30.             IF success
  31.                 DO resource
  32.             ENDIF
  33.         ENDIF
  34.         DO final
  35.     ENDIF
  36. ENDIF
  37.  
  38. * Now clean up and restore the environment
  39.  
  40. RELEASE MODULE isdiskin
  41. ON ERROR
  42. DO cleanup
  43. SET VIEW TO adduser
  44. IF SET("TALK") = "ON"
  45.     SET TALK OFF
  46.     DELETE FILE adduser.vue
  47.     SET TALK ON
  48. ELSE
  49.     DELETE FILE adduser.vue
  50. ENDIF
  51. RETURN
  52.  
  53. *************************************************************
  54. * SETUP - Initialize CONFIG.FP parameters and other globals *
  55. *************************************************************
  56. PROCEDURE setup
  57.  
  58. * Setup the environment *
  59.  
  60. SET TALK OFF
  61. SET ESCAPE OFF
  62. SET MESSAGE TO 24 CENTER
  63. SET STATUS OFF
  64. SET MOUSE OFF
  65. SET SYSMENU OFF
  66. SET DEBUG OFF
  67.  
  68. * Close any open windows *
  69.  
  70. DO WHILE .T.
  71.     wname = WONTOP()
  72.     IF LEN(wname) = 0
  73.         EXIT
  74.     ENDIF
  75.     RELEASE WINDOW &wname
  76. ENDDO
  77.  
  78. * Fiddle with the color scheme
  79.  
  80. myscheme = SCHEME(1)
  81. spos = AT(",", myscheme, 4) + 1
  82. len = AT(",", myscheme, 5) - spos
  83. myscheme = STUFF(myscheme, spos, len, SCHEME(1,4))
  84. SET COLOR OF SCHEME 1 TO &myscheme
  85. myscheme = SCHEME(2)
  86. spos = AT(",", myscheme, 4) + 1
  87. len = AT(",", myscheme, 5) - spos
  88. myscheme = STUFF(myscheme, spos, len, SCHEME(1,4))
  89. SET COLOR OF SCHEME 2 TO &myscheme
  90. CLEAR
  91.  
  92. * Bring in the floppy disk checking utility
  93.  
  94. LOAD isdiskin
  95.  
  96. * Initialize globals 
  97.  
  98. keyword[1] = ""
  99. keyword[2] = "RESOURCE"
  100. keyword[3] = "OVERLAY"
  101. keyword[4] = "EDITWORK"
  102. keyword[5] = "SORTWORK"
  103. keyword[6] = "PROGWORK"
  104.  
  105. bootdisk = UPPER(LEFT(GETENV('comspec'), 1))
  106. savedir = SYS(5)+SYS(2003)
  107. totopts = 6
  108. cr = CHR(13)+CHR(10)+CHR(13)+CHR(10)
  109. maxpath = 130
  110. defdir = SPACE(maxpath)
  111. IF bootdisk <> 'A' .AND. bootdisk <> 'B'
  112.  
  113. * Use current working directory of boot disk as default location
  114.  
  115.     SET DEFAULT TO (bootdisk)            
  116.     STORE PADR(bootdisk+ ":" + SYS(2003), 130)    TO defdir
  117.     SET DEFAULT TO (savedir)
  118. ENDIF
  119.  
  120. RETURN
  121.  
  122. **************************************************************************
  123. * GETDEFAULTS - Initialize directories and pathnames with default values *
  124. **************************************************************************
  125. PROCEDURE getdefaults
  126.  
  127. * Initialize file location parameter values
  128.  
  129. FOR option = 1 TO totopts
  130.     loc[option] = defdir
  131.     IF RIGHT(loc[option], 1) <> '\'
  132.         loc[option] = loc[option] + '\'
  133.     ENDIF
  134. ENDFOR
  135. loc[1] = loc[1] + "CONFIG.FP"
  136. loc[2] = loc[2] + "FOXUSER.DBF"
  137.  
  138. * See if there is a default config file
  139.  
  140. cfgdef = FOPEN(SYS(2004)+"CONFIG.DEF", 0)    && Try opening default config
  141. IF cfgdef <> -1                                && Does it exist?
  142.     filesize = FSEEK(cfgdef, 0, 2)
  143.     = FSEEK(cfgdef, 0, 0)
  144.     contents = FREAD(cfgdef, filesize)        && Read its contents
  145.     = FCLOSE(cfgdef)
  146.     FOR option = 2 TO totopts                && Look for overriding parameters
  147.         spos = ATC(keyword[option], contents)
  148.         IF spos <> 0                        && Found parameter, extract it
  149.             spos = spos + AT("=", SUBSTR(contents, spos))
  150.             len = AT(CHR(13)+CHR(10), SUBSTR(contents, spos)) - 1
  151.             loc[option] = ALLTRIM(SUBSTR(contents, spos, IIF(len <> 0, len, filesize)))
  152.         ENDIF
  153.     ENDFOR
  154. ENDIF
  155.  
  156. FOR option = 1 TO totopts
  157.     IF LEN(loc[option]) < maxpath
  158.         loc[option] = PADR(loc[option], maxpath)
  159.     ENDIF
  160. ENDFOR
  161.  
  162. RETURN
  163.  
  164. ************************************
  165. * CONFIG - Do the interactive part *
  166. ************************************
  167. FUNCTION config
  168. DIMENSION say[6]
  169. say[1] = "CONFIG.FP pathname         "
  170. say[2] = "FOXUSER pathname           "
  171. say[3] = "Overlay files directory    "
  172. say[4] = "Editor work files directory"
  173. say[5] = "Sort work files directory  "
  174. say[6] = "Program work file directory"
  175. DEFINE WINDOW explain FROM 10,4 TO 22,75 DOUBLE ;
  176.         TITLE ' Description of Configuration Option '
  177.  
  178. ok = .F.
  179. ans = 1
  180. @ 1,0 TO 24,79 CLEAR
  181. @ 1, 62 SAY "Free Disk Space"
  182. DO WHILE ans = 1
  183.     FOR option = 1 TO totopts
  184.         row = option + IIF(option < 3, 1, 2)
  185.         @ row,3 SAY say[option] GET loc[option] FUNCTION "S30" ;
  186.             WHEN getinfo() VALID validinfo() ;
  187.             ERROR "Invalid directory or pathname";
  188.             MESSAGE "Press F10 or PgDn when you have completed your modifications."
  189.     ENDFOR
  190.     option = 0
  191.     READ
  192.     @ option + IIF(option < 3, 1, 2), 64 SAY SPACE(11)
  193.     @ 24,0                            && Clear message line
  194.     @ 23,15 PROMPT " \<Modify " ;
  195.         MESSAGE "Modify the configuration options displayed above."
  196.     @ 23,29 PROMPT " \<Proceed " ;
  197.         MESSAGE "Your AUTOEXEC.BAT will be modified and a CONFIG.FP created."
  198.     @ 23,44 PROMPT " \<Abort " ;
  199.         MESSAGE "Cancel the configuration procedure without making any changes."
  200.     @ 23,57 PROMPT " \<Filer " ;
  201.             MESSAGE "Browse the directories on your disk ... Press ESCAPE to continue."
  202.     MENU TO ans
  203.     IF ans = 4
  204.         FILER
  205.         IF WEXIST("Filer")
  206.             DEACTIVATE WINDOW FILER
  207.         ENDIF
  208.         DO WHILE .T.        && Close any editor windows opened from filer
  209.             wname = WONTOP()
  210.             IF UPPER(wname) <> "EXPLAIN"
  211.                 RELEASE WINDOW &wname
  212.             ELSE
  213.                 EXIT
  214.             ENDIF
  215.         ENDDO
  216.         ans = 1
  217.     ENDIF
  218.     @ 23,0
  219. ENDDO
  220. RELEASE WINDOW explain
  221. RETURN IIF(ans = 2, .T., .F.)
  222.  
  223. ******************************************
  224. * GETFINFO - This is the WHEN clause UDF *
  225. ******************************************
  226. FUNCTION getinfo
  227. error = .F.
  228.  
  229. * Clear old stats *
  230.  
  231. IF option <> 0
  232.     @ option + IIF(option < 3, 1, 2), 64 SAY SPACE(11)
  233. ENDIF
  234.  
  235. getvar = SYS(18)
  236. option = VAL(SUBSTR(getvar, 5))
  237. pathname = loc[option]
  238.  
  239. * Show available disk space * 
  240.  
  241. IF LEN(ALLTRIM(&getvar)) <> 0
  242.     ON ERROR error = .T.
  243.     SET DEFAULT TO LEFT(pathname, 1)
  244.     ON ERROR DO abort
  245.     IF .NOT. error .AND. .NOT. INLIST(SYS(5), "A:", "B:")
  246.         @ option + IIF(option < 3, 1, 2), 64 SAY TRANSFORM(DISKSPACE(),"999,999,999")
  247.     ENDIF
  248.     SET DEFAULT TO (savedir)
  249.     IF error
  250.         DO abort
  251.     ENDIF
  252. ENDIF
  253.  
  254. * Display explanation of configuration option *
  255.  
  256. DO explanation
  257. RETURN .T.
  258.  
  259. ********************************************
  260. * VALIDINFO - This is the VALID clause UDF *
  261. ********************************************
  262. FUNCTION validinfo
  263. ok = .T.
  264. getvar = SYS(18)
  265. option = VAL(SUBSTR(getvar, 5))
  266. pathname = UPPER(ALLTRIM(loc[option]))
  267.  
  268. * Validate the parameter *
  269.  
  270. DO CASE option
  271. CASE option = 1
  272.     basename = "CONFIG.FP"
  273. CASE option = 2
  274.     basename = "FOXUSER.DBF"
  275. OTHERWISE
  276.     basename = ""
  277. ENDCASE
  278. ok = validparm()
  279.  
  280. * Save validated directory or pathname *
  281.  
  282. IF ok
  283.     loc[option] = IIF(LEN(pathname) > maxpath, pathname, PADR(pathname, maxpath))
  284. ENDIF
  285. RETURN ok
  286.  
  287. ******************************************
  288. * ABORT - Error occurred: Just shut down *
  289. ******************************************
  290. PROCEDURE abort
  291. ON ERROR
  292. CLEAR TYPEAHEAD
  293. WAIT MESSAGE() WINDOW TIMEOUT 20
  294. IF ERROR() = 1001
  295.     ON ERROR DO abort
  296.     RETURN
  297. ENDIF
  298. DO cleanup
  299. QUIT
  300.  
  301. *************************************************
  302. * CLEANUP - Close everything down                *
  303. *************************************************
  304. PROCEDURE cleanup
  305. CLEAR MACROS
  306. CLEAR ALL
  307. CLEAR
  308. ON KEY
  309. SET MOUSE ON
  310. RETURN
  311.  
  312. ************************************************
  313. * CHECKDISK - Make sure boot disk is available *
  314. ************************************************
  315. FUNCTION checkdisk
  316. PARAMETER drive, disktype
  317. diskin = .F.
  318. checking = .T.
  319. dletter = UPPER(drive)
  320. DO WHILE .NOT. diskin .AND. checking
  321.     CALL isdiskin WITH dletter
  322.     IF dletter = '0'
  323.         dletter = UPPER(drive)
  324.         WAIT "Insert your " + IIF(LEN(disktype) = 0, "work files", disktype) ;
  325.         + " disk in Drive " + dletter + ".  Press any key to continue." WINDOW
  326.         IF LASTKEY() = 27
  327.             checking = .F.
  328.         ENDIF
  329.     ELSE
  330.         diskin = .T.
  331.     ENDIF
  332. ENDDO
  333. RETURN diskin
  334.  
  335. *************************************************************
  336. * AUTOEXEC - Create or modify the workstation autoexec file *
  337. *************************************************************
  338. FUNCTION autoexec
  339. IF !checkdisk(bootdisk, "boot")
  340.     RETURN .F.
  341. ENDIF
  342. filename = bootdisk + ":\AUTOEXEC.BAT"
  343. setcmd = "SET FOXPROCFG="+loc[1]+CHR(13)+CHR(10)
  344. autoexec = FOPEN(filename, 2)
  345. IF autoexec == -1                        && Can't find autoexec.bat
  346.     autoexec = FCREATE(filename, 0)        && Create an autoexec.bat
  347.     IF autoexec == -1
  348.         RETURN .F.
  349.     ELSE
  350.         = FWRITE(autoexec, setcmd)
  351.         = FCLOSE(autoexec)
  352.         RETURN .T.
  353.     ENDIF
  354. ELSE                                && Found one so modify it
  355.     filesize = FSEEK(autoexec, 0, 2)
  356.     = FSEEK(autoexec, 0, 0)
  357.     contents = FREAD(autoexec, filesize)
  358.     spos = ATC("SET FOXPROCFG", contents)
  359.     IF spos <> 0                    && Already there, just modify
  360.         len = AT(CHR(13)+CHR(10), SUBSTR(contents, spos)) + 1
  361.         IF len = 0
  362.             len = LEN(SUBSTR(contents, spos))
  363.         ENDIF
  364.     ELSE                            && Not there, append
  365.         len = AT(CHR(26), contents)
  366.         IF len <> 0
  367.             contents = LEFT(contents, len - 1)
  368.             len = 0
  369.         ENDIF
  370.         spos = RAT(CHR(13)+CHR(10), contents, ;
  371.                     IIF(RIGHT(contents, 2) <> CHR(13)+CHR(10), 1, 2))
  372.         spos = spos + IIF(spos = 0, 1, 2)
  373.     ENDIF
  374.     contents = STUFF(contents, spos, len, setcmd)
  375.     = FSEEK(autoexec, 0, 0)
  376.     = FWRITE(autoexec, contents)
  377.     = FCHSIZE(autoexec, LEN(contents))
  378.     = FCLOSE(autoexec)
  379. ENDIF
  380. RETURN .T.
  381.  
  382. ********************************************************
  383. * CONFIG_FP - Create or modify workstation CONFIG file *
  384. ********************************************************
  385. FUNCTION config_fp
  386. IF !checkdisk(LEFT(loc[1], 1), loc[1])
  387.     RETURN .F.
  388. ENDIF
  389.  
  390. config = FOPEN(loc[1], 2)            && Open the config file
  391. IF config == -1                        && Can't find it?
  392.     config = FCREATE(loc[1], 0)        && Create a config file
  393.     IF config == -1
  394.         RETURN .F.
  395.     ELSE                            && Use default config file as basis
  396.         cfgdef = FOPEN(SYS(2004)+"CONFIG.DEF", 0)    && Open default config
  397.         IF cfgdef <> -1                                && Does it exist?
  398.             filesize = FSEEK(cfgdef, 0, 2)
  399.             = FSEEK(cfgdef, 0, 0)
  400.             contents = FREAD(cfgdef, filesize)        && Read its contents
  401.             = FCLOSE(cfgdef)
  402.             IF RIGHT(contents, 2) <> CHR(13)+CHR(10)
  403.                 contents = contents + CHR(13)+CHR(10)
  404.             ENDIF
  405.             FOR option = 2 TO totopts    && Remove default config options
  406.                 spos = ATC(keyword[option], contents)
  407.                 IF spos <> 0        && Found it
  408.                     len = AT(CHR(13)+CHR(10), SUBSTR(contents, spos)) + 1
  409.                     contents = STUFF(contents, spos, len, "")
  410.                 ENDIF
  411.             ENDFOR
  412.         ELSE
  413.             contents = ""
  414.         ENDIF
  415.         FOR option = 2 TO totopts                    && Now append directory options
  416.             contents = contents + keyword[option] + "=" + loc[option] + ;
  417.                         IIF(option=3," OVERWRITE","") + CHR(13) + CHR(10)
  418.         ENDFOR
  419.         = FWRITE(config, contents)
  420.         = FCLOSE(config)
  421.         RETURN .T.
  422.     ENDIF
  423. ELSE                                && Found one so modify it
  424.     filesize = FSEEK(config, 0, 2)
  425.     = FSEEK(config, 0, 0)
  426.     contents = FREAD(config, filesize)
  427.     FOR option = 2 TO totopts
  428.         configcmd = keyword[option] + "=" + loc[option] + ;
  429.                     IIF(option=3," OVERWRITE","") + CHR(13) + CHR(10)
  430.         spos = ATC(keyword[option], contents)
  431.         IF spos <> 0                    && Already there, just modify
  432.             len = AT(CHR(13)+CHR(10), SUBSTR(contents, spos)) + 1
  433.             IF len = 0
  434.                 len = LEN(SUBSTR(contents, spos))
  435.             ENDIF
  436.         ELSE                            && Not there, append
  437.             IF RIGHT(contents, 2) <> CHR(13)+CHR(10)
  438.                 configcmd = CHR(13)+CHR(10)+configcmd
  439.             ENDIF
  440.             spos = filesize + 1
  441.             len = 0
  442.         ENDIF
  443.         contents = STUFF(contents, spos, len, configcmd)
  444.     ENDFOR
  445.         
  446.     = FSEEK(config, 0, 0)
  447.     = FWRITE(config, contents)
  448.     = FCHSIZE(config, LEN(contents))
  449.     = FCLOSE(config)
  450. ENDIF
  451. RETURN .T.
  452.  
  453. ************************************************************************
  454. * RESOURCE - If FOXUSER file doesn't exist for this work station, copy *
  455. *            DEFUSER file as FOXUSER for this work station.               *
  456. ************************************************************************
  457. PROCEDURE resource
  458. deffile = SYS(2004)+"DEFUSER.DBF"
  459. IF .NOT. FILE(deffile)        
  460.     RETURN        && Don't bother if default resource doesn't exist
  461. ENDIF
  462.  
  463. IF FILE(loc[2])        && Resource file for work station already exists
  464.     RETURN
  465. ENDIF
  466.         
  467. USE (deffile)
  468. COPY TO (loc[2])
  469. USE
  470. RETURN
  471.  
  472. *****************************************************************
  473. * VALIDPARM - Make sure you have a valid pathname or directory     *
  474. *****************************************************************
  475. PROCEDURE validparm
  476. IF .NOT. checkdisk(LEFT(pathname, 1), basename)
  477.     RETURN .F.
  478. ENDIF
  479.  
  480. needdir = IIF(LEN(basename) = 0, .T., .F.)
  481. IF .NOT. needdir
  482.     extension = SUBSTR(basename, AT(".", basename))
  483. ENDIF
  484. STORE .T. TO ok, isdir
  485.  
  486. ON ERROR isdir = .F.
  487. SET DEFAULT TO (pathname)                && See if it is a directory
  488. ON ERROR DO abort                        && Restore error condition
  489. SET DEFAULT TO (savedir)                && Restore old default value
  490. IF .NOT. isdir                            && It was not a valid directory
  491.     IF needdir
  492.         ok = mkdir(pathname)
  493.     ELSE                                && It's supposed to be a pathname
  494.         lastpos = RAT('\', pathname)
  495.         IF lastpos > 3                    && Make sure all dirs. exist
  496.             IF lastpos <> LEN(pathname)    && Remove any filename part
  497.                 isdir = .T.
  498.                 ON ERROR isdir = .F.
  499.                 SET DEFAULT TO (LEFT(pathname, lastpos-1))
  500.                 ON ERROR DO abort
  501.                 SET DEFAULT TO (savedir)
  502.             ENDIF
  503.             IF .NOT. isdir
  504.                 ok = mkdir(LEFT(pathname, lastpos-1))
  505.             ENDIF
  506.         ENDIF
  507.         IF ok .AND. lastpos <> LEN(pathname)    && Must be a filename
  508.             isdir = .F.
  509.             IF AT('.', pathname) = 0
  510.                 pathname = pathname + extension
  511.             ENDIF
  512.         ENDIF
  513.     ENDIF
  514. ENDIF
  515. IF isdir                                && Must have been a valid directory
  516.     IF RIGHT(pathname,1) <> "\"
  517.         pathname = pathname + "\"
  518.     ENDIF
  519.     IF .NOT. needdir                    && Must need a filename
  520.         pathname = pathname + basename
  521.     ENDIF
  522. ENDIF
  523. RETURN ok
  524.  
  525. ********************************************************
  526. * MKDIR - Find out if user wants to create a directory *
  527. ********************************************************
  528. FUNCTION mkdir
  529. PARAMETER directory
  530. STORE .T. TO ok
  531. ans = 2
  532. DEFINE WINDOW alert FROM 13,14 to 18,66 COLOR SCHEME 7 DOUBLE
  533. ACTIVATE WINDOW alert
  534. ?? CHR(7)
  535. ?? directory + " does not exist.  Do you want to " + ;
  536.     "create it?" ;
  537.     AT 1 FUNCTION "v49"
  538. @ 3,11 PROMPT "   \<Yes   "
  539. @ 3,31 PROMPT "   \<No   "
  540. MENU TO ans
  541. RELEASE WINDOW alert
  542. IF ans <> 1
  543.     ok = .F.
  544. ELSE
  545.     isdir = .T.
  546.     next = 2                        && Start looking after the root
  547.     ok = checkdisk(LEFT(directory,1), basename)
  548.     DO WHILE ok
  549.         pos = AT('\', directory, next)
  550.         work = IIF(pos <> 0, LEFT(directory, pos-1), directory)
  551.         ON ERROR isdir = .F.
  552.         SET DEFAULT TO (work)        && See if it is a directory
  553.         ON ERROR DO abort            && Restore error condition
  554.         IF .NOT. isdir
  555.             command = "RUN mkdir " + work
  556.             &command
  557.             isdir = .T.
  558.             ON ERROR isdir = .F.
  559.             SET DEFAULT TO (work)        && Check if successful
  560.             ON ERROR DO abort
  561.             ok = isdir
  562.         ENDIF
  563.         IF pos = LEN(directory)
  564.             pos = 0
  565.         ENDIF
  566.         IF pos = 0 .OR. .NOT. ok
  567.             EXIT
  568.         ELSE
  569.             next = next + 1
  570.         ENDIF
  571.     ENDDO
  572.     SET DEFAULT TO (savedir)    && Restore old default value
  573. ENDIF
  574. RETURN ok
  575.  
  576. ************************************************
  577. * PROCEED - Describe the configuration process *
  578. ************************************************
  579. FUNCTION proceed
  580. lmarg = 4
  581. @ 0,0 SAY PADC("Configuring Your FoxPro Work Station", 80)
  582. ? "The ADDUSER utility enables you to customize your individual work station and "+;
  583.    "configure it for optimal performance on your FoxPro multi-user system.";
  584.    AT lmarg FUNCTION "v72"
  585. ?
  586. ?  "Each work station should have its own CONFIG.FP and FOXUSER files.  "+;
  587.    "The CONFIG.FP file contains a set of options that specify the default  "+; 
  588.    "environment when FoxPro starts up.  The FOXUSER file contains "+;
  589.    "a variety of information affecting your operating environment "+;
  590.    "including window sizes and positions, color sets, diary entries, etc.  "+;  
  591.    "ADDUSER insures that these two files exist either on your local "+;
  592.    "drive or in a network directory assigned to your individual work "+;
  593.    "station.";
  594.    AT lmarg FUNCTION "v72"
  595. ?
  596. ? "There are other FoxPro files that should reside on your local hard "+; 
  597.    "drive (if at all possible) in order to reduce the amount of traffic "+;
  598.    "between the server and your work station.  These include the FoxPro "+;
  599.    "overlay and temporary work files.";
  600.    AT lmarg FUNCTION "v72"
  601. ?
  602. *? "The first step is to determine where these FoxPro files will reside...";
  603. *   AT lmarg FUNCTION "v72"
  604. ? "Displayed below is the directory that will be used as a starting point "+;
  605.   "for finetuning your configuration.  Make any changes and press ENTER "+;
  606.   "to continue." AT lmarg FUNCTION "v72"
  607. @ 22, 3 TO 24, 74 DOUBLE
  608. @ 23, 6 GET defdir FUNCTION "s65"
  609. READ
  610. defdir = ALLTRIM(defdir)
  611. DO getdefaults
  612.  
  613. @ 23, 6 TO 23, 73 CLEAR
  614. @ 23, 6 PROMPT " \<Continue with configuration " 
  615. @ 23, 41 PROMPT " \<Abort configuration procedure "
  616. MENU TO ans
  617. RETURN IIF(ans = 1, .T., .F.)
  618.  
  619. **********************************************************************
  620. * EXPLANATION - Display an explanation for each configuration option *
  621. **********************************************************************
  622. PROCEDURE explanation
  623. ACTIVATE WINDOW explain
  624. CLEAR
  625. DO CASE
  626. CASE option = 1
  627.    msg = "The "+;
  628.    "CONFIG.FP file contains a set of options that specify the default "+;
  629.    "environment when FoxPro starts up.  It is typically small "+;
  630.    "(less than 1024 bytes) but can be several thousand bytes if it contains "+;
  631.    "many options.  Since it is accessed only on startup, performance will "+;
  632.    "not be affected if it is located on the network.  It must, however, "+;
  633.    "have either a unique location or filename that is designated for your "+;
  634.    "work station."+cr+"A new SET command will be added to your "+;
  635.    "AUTOEXEC.BAT file which tells FoxPro where to find your CONFIG.FP."
  636. CASE option = 2
  637.    msg = "FOXUSER, the FoxPro resource file, is actually a standard FoxPro "+;
  638.    "database with a memo field and an index.  It contains a variety of "+;
  639.    "information affecting your operating environment including window sizes "+;
  640.    "and positions, color sets, diary entries, etc.  FOXUSER "+;
  641.    "requires a minimum of 12K of disk space.  As you use FOXPRO interactively, "+;
  642.    "new records may be added to this file."+cr+"If you do not "+;
  643.    "specify either a directory or filename that is unique to your work "+;
  644.    "station, access to the resource file will be disabled."
  645. CASE option = 3
  646.    msg = "FoxPro's overlay files require about 575K bytes of disk space.  These "+;
  647.    "files are accessed very frequently while operating FoxPro so they "+;
  648.    "should be located on the highest speed device available.  Usually, it is "+;
  649.    "desirable to place these files on your local hard drive or on a RAM disk.  "+;
  650.    cr+"On startup, FoxPro always insures that there are valid copies of these files "+;
  651.    "in the directory you specified; therefore, you never have to "+;
  652.    "copy these files yourself."
  653. CASE option = 4
  654.    msg = "For each editor session, FoxPro creates a temporary work file "+;
  655.    "that can become as large as the original file being edited.  "+;
  656.    "And, of course, you may have several editing sessions in progress simultaneously."+;
  657.    cr+"For the best response time while editing your files you should "+;
  658.    "place these files on your local drive if at all possible.  "+;
  659.    "In any case, you should insure that you have enough disk space on "+;
  660.    "the device you specify for your editing sessions."
  661. CASE option = 5
  662.    msg = "FoxPro creates temporary work files when SORTing and INDEXing.  The "+;
  663.    "work files for sorting can be as much as three times the size of the "+;
  664.    "original database.  The work files for indexing can be as much as three times "+;
  665.    "the size of the resulting index file."+cr+"High speed access to these work "+;
  666.    "files is a critical factor in performance for sorting and indexing "+;
  667.    "so these files should be placed on your local drive if at all possible.  "+;
  668.    "In any case, you should insure that you have enough disk space on "+;
  669.    "the device you specify for sorting and indexing your databases."
  670. CASE option = 6
  671.    msg = "FoxPro uses a special work file for managing the programs you call "+;
  672.    "while running your applications.  This file is generally less than "+;
  673.    "256K bytes and is a good candidate to be situated on a RAM disk if you "+;
  674.    "have one."
  675. ENDCASE
  676. ?? msg AT 1 FUNCTION "v67"
  677. RETURN
  678.  
  679. ***********************************************************************
  680. * FLOPPY - If booting from floppy, display message to insert bootdisk *
  681. ***********************************************************************
  682. PROCEDURE floppy
  683. DEFINE WINDOW explain FROM 10,10 to 17,70 DOUBLE
  684. ACTIVATE WINDOW explain
  685. msg = "Your AUTOEXEC.BAT will be modified to tell FoxPro where to "+;
  686.     "find your CONFIG.FP file.  Please insert your boot disk in Drive "+;
  687.     bootdisk + ": and make sure that it is not write-protected."+;
  688.     cr+"Press any key to continue..."
  689. ?? msg AT 1 FUNCTION "v57"
  690. WAIT ""
  691. RETURN
  692.  
  693. *****************************************************************************
  694. * FINAL - Display message to reboot system before next invokation of FoxPro *
  695. *****************************************************************************
  696. PROCEDURE final
  697. DEFINE WINDOW explain FROM 10,10 to 17,70 DOUBLE
  698. ACTIVATE WINDOW explain
  699. IF success
  700.     msg = "Your AUTOEXEC.BAT file has been modified to tell FoxPro where to "+;
  701.     "find your CONFIG.FP file.  Exit FoxPro in the normal manner and reboot "+;
  702.     "your system before you "+;
  703.     "start up FoxPro again in order for your changes to take effect."+;
  704.     cr+"Press any key to continue..."
  705. ELSE
  706.     msg = "Unable to create or modify your AUTOEXEC.BAT and/or your "+;
  707.     "CONFIG.FP file.  Please consult your network administrator."+cr+;
  708.     "Press any key to continue..."
  709. ENDIF
  710. ?? msg AT 1 FUNCTION "v57"
  711. WAIT ""
  712. RETURN
  713.  
  714.