G-Day all
I have run upon something curious and would like to get some feedback as to
what others have seen. I run this file (default.dat) from the command line on
RBase65 Dos and Win Shortcuts using Syntax like this:
K:\rbti\RBDOS65\RBASE65.EXE -ok:\rbusers\user\dos65\rbase.cfg default.dat -r
We always run this or some other dat file upon startup and when testing some
changes I made I ran across that the command SET VAR vm_temp = (ENVVAL('TEMP'))
gives different results. When run under DOS it returns C:\WINNT\TEMP, and when
run under windows it returns something like
C:\DOCUME~1\JLIMBU~1.TCO\LOCALS~1\Temp
Anyone know why?
Here is the code I run:
*(
--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
PROGRAM NAME: Default.dat
AUTHOR: Jim Limburg
Tuftco Corporation
2318 Holtzclaw Ave, Chattanooga, TN 37404
Voice: 423-698-8601 Fax: 423-698-0842
Email: [EMAIL PROTECTED]
[EMAIL PROTECTED]
PURPOSE: To set up the users TEMP environment whether they
are using RBase65 DOS or WIN. It also will attempt to
keep the number of $$$ files down.
IS RUN BY: Called within the Command Line in Shortcut
for the RBase executable. The Command line
to Run the DOS version 6.5 will be:
K:\rbti\RBDOS65\RBASE65.EXE -ok:\rbusers\usersname\dos65\rbase.cfg default.dat
-r
The command line to run the Win version 6.5 will be:
K:\rbti\rbwin65\RBG65.EXE -ok:\rbusers\usersname\win65\rbase.cfg default.dat -r
RETURNS: none
MODIFICATION HISTORY
Created: 12/18/2001
Modified: 05/20/2002
This was changed drastically on this date.
There was a big error in this code to begin with
as in it did not account for the error handling
correctly when running DOS 65...
The command SET ERROR MESSAGES 2926 OFF was
throwing all kinds of errors. This is a WIN only
command. Now it will detect what version this is
being called from and setup things accordingly.
This will setup the users Temp directory regardless
of whether they are using RBDOS65 for RBWIN65.
--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
)
*(I use these next statements to figure out if I'm in a DOS
version of RBase or Windows. This is used in decision
structures within the application to decide on what to
test for, or how something will need to be stated as
far as syntax is concerned.)
SET VAR vg_version = (CVAL('version'))
SET VAR vg_version TEXT
IF vg_version IS NOT NULL THEN
SET VAR vg_verdos = (SLOC(.vg_version,'DOS'))
SET VAR vg_verdos INTEGER
*(For RBase to work correctly it has to have it's own temporary
directory. This is stored in the SET SCRATCH setting.
This routine figures out the most proper place to put this by
doing the following:
It first looks to the Environment settings on the machine to
see if the TEMP has been set to a directory. On a Win2k machine
this is ususally something like %SystemRoot%\TEMP which is
C:\WINNT\TEMP, on Win98 machines this is usually something
like C:\Windows\temp.
If this Environment setting is not set then it will attempt
to check to figure what kind of machine this is. It will first
look to see if it's a Win2k machine by looking for a
C:\WINNT\TEMP directory, if it does not find this then it looks
for a C:\WINDOWS\TEMP directory. If it does not find the
C:\WINDOWS\TEMP directory then it will look for a C:\TEMP.
If it does not find a C:\TEMP then it will create one. If it
fails to create one, then it will attempt to assign the
directory it is dealing with --which is usually the network to
be the SCRATCH directory. )
IF vg_verdos > 0 THEN -- RBDOS version if true
--Setting error messages off here so the Deletion of the $$$ files
--does not throw an erro to the user when they are not present
SET ERROR MESSAGES OFF
SET MESSAGES OFF
ENDIF
SET VAR vg_tmpdir TEXT
SET VAR vm_temp TEXT = NULL
SET VAR vm_temp = (ENVVAL('TEMP')) --See if TEMP is defined in Environment
IF vm_temp IS NOT NULL THEN
SET SCRATCH .vm_temp
SET VAR vm_delfiles TEXT = ('ERASE ' + .vm_temp + '\' + '*.$$$')
IF vg_verdos = 0 THEN -- RBWin version if true
SET ERROR MESSAGES 2926 OFF
SET ERROR MESSAGES 2077 OFF
ENDIF
&vm_delfiles
IF vg_verdos = 0 THEN -- RBWin version if true
SET ERROR MESSAGES 2077 ON
SET ERROR MESSAGES 2926 ON
ENDIF
SET VAR vg_tmpdir TEXT = .vm_temp
ELSE
SET VAR vm_dir INTEGER = (CHKFILE('C:\WINNT\TEMP'))
IF vm_dir = 1 THEN
SET VAR vm_temp TEXT = 'C:\WINNT\TEMP'
SET SCRATCH .vm_temp
SET VAR vm_delfiles TEXT = ('ERASE ' + .vm_temp + '\' + '*.$$$')
IF vg_verdos = 0 THEN -- RBWin version if true
SET ERROR MESSAGES 2926 OFF
SET ERROR MESSAGES 2077 OFF
ENDIF
&vm_delfiles
IF vg_verdos = 0 THEN -- RBWin version if true
SET ERROR MESSAGES 2077 ON
SET ERROR MESSAGES 2926 ON
ENDIF
ELSE --c:\winnt\temp does not exist, try another route.
SET VAR vm_dir INTEGER = (CHKFILE('C:\WINDOWS\TEMP'))
IF vm_dir = 1 THEN
SET VAR vm_temp TEXT = 'C:\WINDOWS\TEMP'
SET SCRATCH .vm_temp
SET VAR vm_delfiles TEXT = ('ERASE ' + .vm_temp + '\' + '*.$$$')
IF vg_verdos = 0 THEN -- RBWin version if true
SET ERROR MESSAGES 2926 OFF
SET ERROR MESSAGES 2077 OFF
ENDIF
&vm_delfiles
IF vg_verdos = 0 THEN -- RBWin version if true
SET ERROR MESSAGES 2077 ON
SET ERROR MESSAGES 2926 ON
ENDIF
ELSE
SET VAR vm_dir INTEGER = (CHKFILE('C:\TEMP'))
IF vm_dir = 1 THEN
SET VAR vm_temp TEXT = 'C:\TEMP'
SET SCRATCH .vm_temp
SET VAR vm_delfiles TEXT = ('ERASE ' + .vm_temp + '\' + '*.$$$')
IF vg_verdos = 0 THEN -- RBWin version if true
SET ERROR MESSAGES 2926 OFF
SET ERROR MESSAGES 2077 OFF
ENDIF
&vm_delfiles
IF vg_verdos = 0 THEN -- RBWin version if true
SET ERROR MESSAGES 2077 ON
SET ERROR MESSAGES 2926 ON
ENDIF
ELSE
*(If the process gets this far then it has not found
and has not set the SCRATCH setting to any temporary
place for RBase to work. Attempt to create C:\TEMP and
use it. If this fails then use the current directory
it is in and hope the user has the proper Read/Write/
File Scan/Create/Delete access. )
--Record the directory the user is in now so we can
--return to it after our other work.
SET VAR vm_tmpcurrhold = (CVAL('CURRDIR'))
CHDRV c:
CHDIR c:\
MKDIR TEMP
SET VAR vm_dir INTEGER = (CHKFILE('C:\TEMP'))
IF vm_dir = 1 THEN
SET VAR vm_temp TEXT = 'C:\TEMP'
SET SCRATCH .vm_temp
SET VAR vm_delfiles TEXT = ('ERASE ' + .vm_temp + '\' + '*.$$$')
IF vg_verdos = 0 THEN -- RBWin version if true
SET ERROR MESSAGES 2926 OFF
SET ERROR MESSAGES 2077 OFF
ENDIF
&vm_delfiles
IF vg_verdos = 0 THEN -- RBWin version if true
SET ERROR MESSAGES 2077 ON
SET ERROR MESSAGES 2926 ON
ENDIF
ELSE
SET VAR vm_temp = (CVAL('CURRDIR'))
-- will be the directory the database
-- is in since we are connneted
SET SCRATCH .vm_temp
SET VAR vm_delfiles TEXT = ('ERASE ' + .vm_temp + '\' + '*.$$$')
IF vg_verdos = 0 THEN -- RBWin version if true
SET ERROR MESSAGES 2926 OFF
SET ERROR MESSAGES 2077 OFF
ENDIF
&vm_delfiles
IF vg_verdos = 0 THEN -- RBWin version if true
SET ERROR MESSAGES 2077 ON
SET ERROR MESSAGES 2926 ON
ENDIF
ENDIF
SET VAR vm_olddrv TEXT = NULL
SET VAR vm_olddrv = (SGET(.vm_tmpcurrhold,2,1))
IF vm_olddrv IS NOT NULL THEN
CHDRV &vm_olddrv
SET VAR vm_olddrv = (.vm_olddrv + '\')
CHDIR &vm_olddrv
CHDIR &vm_tmpcurrhold
ENDIF
ENDIF
ENDIF
ENDIF
SET VAR vg_tmpdir TEXT = .vm_temp
ENDIF
SET DATE FORMAT MM/DD/YY
SET DATE SEQUENCE mmddyy
SET DATE CENTURY 19
SET DATE YEAR 50
SET FILES 60
IF vg_verdos > 0 THEN -- RBDOS version if true
PLAYBACK escplay.pla
ENDIF
CLEAR VAR vm_%, vg_version, vg_verdos
ENDIF
RETURN
Thanks
Jim Limburg
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/