Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : EXPAND30.ZIP
Filename : EXPSHELL.PRG

 
Output of file : EXPSHELL.PRG contained in archive : EXPAND30.ZIP

* ------------------------------------------------------------------------
* Program......: EXPSHELL.PRG, Demo of EXPAND.LIB.
* Author.......: Pepijn Smits.
* Date.........: May 1991.
* Copyright....: (c)1991, Pepijn Smits.
* Notes........: Clipper 'Demo' program of some Functions of EXPAND.LIB:
* Shell to DOS with new Environment variables..
* ------------------------------------------------------------------------
* Be sure to Link in EXPAND.LIB next to CLIPPER and EXTEND!
*
?? 'Expand Shell Demonstration: Shelling to DOS from a Clipper application'
?
? 'Current Environment information:'
? '--------------------------------'
? 'Total size allocated to environment : '+Str(EnvSize())
? 'Space used by environment : '+Str(EnvUsed())
? 'Number of Environment strings : '+Str(EnvCount())
for i = 1 to EnvCount()
? Str(i,3)+' '+EnvStr(i)
next
wait
?
? 'Setting new PROMPT (for Shell to DOS):'
if SetEnv('PROMPT','Clipper Shell, type EXIT to return to applic$_'+GetE('PROMPT'))
? 'New Prompt is : '+ReadEnv('PROMPT')
? 'Old Prompt was : '+GetE('PROMPT')
wait
? 'Shelling to DOS....'

* - Have to set Ptr to Env when Shelling, and restore current (of Course)
x = EnvPtr(EnvOrig())
!Command
EnvPtr(x)

* - Restoring Original Prompt. (Use Gete() and .Not. ReadEnv()!!)
SetEnv('PROMPT',GetE('PROMPT'))
else
? 'Not enough room in environment to change PROMPT, not running..'
endif

? 'QUITting the Shell demo..'

QUIT