home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
PROGRAMM
/
BUILDER.ZIP
/
CHCON1.BLD
< prev
next >
Wrap
Text File
|
1992-11-17
|
3KB
|
83 lines
'==================================================================
' CHCON1.BLD
'
' What it does:
' Searches CONFIG.SYS for the line containing "FILES=" and
' replaces it with the line "FILES=50". Doesn't let the
' user in on this decision; for a version that lets the
' user see what's going on and choose not to make the
' change, see CHCON2.BLD.
'
' Tested using:
' Builder 1.21c
'
' By:
' Tom Campbell
'
'==================================================================
' CHCONFIG.BLD
' Reads CONFIG.SYS and copies is output to TEST.TMP.
' When it finds a line with "FILES=", it changes the line to FILES=50.
' Descriptors for the input file (CONFIG.SYS)
' and the output file (TEST.TMP)
File InFile, OutFile
' Original holds each line as it's read from the file; Upper is
' its uppercase version.
' RevisedLine is the text the line will be changed to.
String Original, RevisedLine, Upper
' FoundIt is 0 until the "FILES=" line is found. When it is,
' FoundIt is set to 1.
Integer FoundIt
cls
' Assume the line with "FILES=" isn't in the file.
Put 0 into FoundIt
Put "FILES=50" into RevisedLine
' Quit if CONFIG.SYS isn't available. Set ERRORLEVEL to 1, which
' traditionally means an error has occurred, on exit.
if not exist "C:\CONFIG.SYS" exit 1
' Make CONFIG.SYS available for file operations.
Open "C:\CONFIG.SYS" for reading as InFile
' It will be copied to TEST.TMP, except for the "FILES=" line, which
' will be replaced with RevisedLine.
Open "TEST.TMP" for writing as OutFile
' This loop continues as long as there are lines in CONFIG.SYS.
While not eof InFile
' Get the next line from "CONFIG.SYS".
ReadLine Original from InFile
' Copy it to the string var Upper, forcing it to uppercase.
Put UpperCase Original into Upper
' See if it's the line in question.
If Upper contains "FILES="
' Note that the line was found.
Put 1 into FoundIt
' Write the new line to the file.
WriteLine RevisedLine to OutFile
end else
' Not the right line. Copy it to "TEST.TMP" unchanged.
' This occurs every time a line that does *not* contain "FILES=" is
' read from the original CONFIG.SYS.
WriteLine Original to OutFile
End ' If
End ' While
' Return file resources to DOS.
Close InFile
Close OutFile
' Explain whether the mission was successful.pressed
if FoundIt is 1
say @ 22, 10 "Successful--was able to alter CONFIG.SYS.";
end else
say @ 22, 10 "CONFIG.SYS was not changed."
end