Hey all:
Here's another I found on an old 5.25" diskette. I spruced it up for you:
*:*******************************************************************
*: Program...........: CkConfig.PRG
*: Author............: Jacqueline D'Elia Compuserve 70314,2502
*: Enhanced by.......: David Lee Powell
*: Project...........: FoxPro Library
*: Created...........: 01-Sep-1990
*: Copyright.........: (c) 1990, Pro Series Software, Inc.
*) Description.......: I never enjoyed walking a user through updating
*) : or creating a CONFIG.SYS over the phone. Run
*) : this program each time an application starts
*) : to check the FILES=?? in CONFIG.SYS. The
*) : parameter lnFiles lets you pass different minimums
*) : for different applications. It will update the
*) : CONFIG.SYS file (with user's permission) and
*) : then ask her to reboot!
*) : This has eliminated the " Too many files open"
*) : support calls.
*) : Feel free to use it!
*: Syntax............: None
*: Parameter list....: lnFiles - the minimum number of files
*: Platform..........: DOS/WINDOWS
*: Major change list.: None
*: Called by.........: None
*: Calls.............: None
*:*******************************************************************
PARA lnFiles
PRIV ALL LIKE j*
SET TALK OFF
SET ECHO OFF
IF TYPE("lnFiles") != "N" && No parameter passed: default to 200
lnFiles = 200
ENDI
lcFiles = STR( lnFiles, 3, 0 )
jnFiles = VAL( SYS(2010) ) && Fox's access to the FILES statement
IF jnfiles > 0 AND jnfiles < lnFiles
SET CURS ON
DEFI WIND wrConfig FROM 00,00 TO 12,43 COLO SCHE 7 SHAD
ACTI WIND wrConfig
MOVE WIND wrConfig CENT
@ 01,00 SAY PADC( "** CONFIG.SYS FILE ERROR **", 42 )
?? CHR(7)
@ 03,03 SAY "The CONFIG.SYS file must be "
@ 04,03 SAY "set for a minimum of FILES="+lcFiles+"."
@ 05,03 SAY "Your settings are FILES="+ALLT(STR(jnfiles,4,0))
@ 06,00 TO 06,42
@ 08,00 TO 08,42
jlOK = .T.
@ 07,01 SAY "Okay to update CONFIG.SYS file? [Y/N] " GET jlOK PICT "Y"
READ
IF ! jlOK
@ 09,03 SAY "You must update config.sys file " COLO BG+/R
@ 10,03 SAY "before you can use this program." COLO BG+/R
=INKEY(5)
SET CLEA OFF
CLOS ALL
CLEA WIND
CANC
ENDI
jcDrive="C"
@ 09,03 SAY "Enter the drive letter where"
@ 10,03 SAY "config.sys file is located: " GET jcDrive PICT "!"
READ
IF LASTKEY() = 27
@ 09,00 CLEA
@ 09,03 SAY "You must update config.sys file " COLO BG+/R
@ 10,03 SAY "before you can use this program." COLO BG+/R
=INKEY(5)
SET CLEA OFF
CLOS ALL
CLEA WIND
CANC
ENDI
jcSysFile = jcDrive + ":\config.sys"
IF ! FILE( jcSysFile )
jnConfig = FCREA( jcSysFile )
=FPUT( jnConfig, "FILES=&lcFiles" )
=FPUT( jnConfig, "BUFFERS=50" )
=FCLO( jnConfig )
ELSE
@ 07,00 CLEA TO 07,42
@ 07,14 SAY "Updating . . ."
@ 07,23 SAY ". . ." COLO GR+*/R
jnConfig = FOPE( jcSysFile, 2 )
IF jnConfig < 0
WAIT WIND "Error: Can not update file. You must" + CHR(13) + ;
"update yourself and then reboot."
CLOS ALL
SET CLEA OFF
CLEA WIND
CANC
ENDI
jlAddline = .T.
DO WHIL ! FEOF( jnConfig )
jcLineIn = FGET( jnConfig )
IF UPPE(SUBS( jcLineIn, 1, 6 )) = "FILES=" OR FEOF( jnConfig )
IF UPPE(SUBS( jcLineIn, 1, 6 )) = "FILES="
STOR LEN(TRIM( jcLineIn )) TO jnLen
=FSEE( jnConfig, -( jnLen +2 ), 1 )
=FPUT( jnConfig, "FILES=&lcFiles" )
jlAddline=.F.
ELSE
IF jlAddline
=FSEE( jnConfig, 0, 2 )
=FPUT( jnConfig, "FILES=&lcFiles" )
ENDI
ENDI
ENDI
ENDD
=FCLOS( jnConfig )
ENDI
?? CHR(7)
@ 09,00 CLEA
@ 09,03 SAY "Reboot computer to activate"
@ 10,03 SAY "updated config.sys file."
=INKEY(5)
SET CLEA OFF
CLOS ALL
CLEA WIND
CANC
ENDI
RELE ALL LIKE j*
RETU
*: EOF: CkConfig()
---------------------------------------------------------------
An interesting, useful addition methinks.
David in Dallas.
--- Maximus/2 3.01
---------------
* Origin: * MacSavvy OS/2 BBS * Dallas, Texas * 972-250-4479 * (1:124/1208)
|