home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Micro R&D 1
/
MicroRD-CD-ROM-Vol1-1994.iso
/
os20
/
cli
/
getstring100.lha
/
GetString
/
GetString.e
< prev
next >
Wrap
Text File
|
1993-01-19
|
1KB
|
52 lines
/* GetString.e
* To get a string requester from Shell (useful in scripts) and store the
* result in an environment variable.
*
* Written by Diego Caravana.
*
* This small utility is placed in the Public Domain, so use it at your own
* risk. Feel free to burn this source... :)
*
* Thanks to Wouter van Oortmerssen for his VERY GOOD work, hoping that he
* will continue to improve E language !
* Hey, consider to learn E !!!
*
*/
OPT OSVERSION=37
MODULE 'ReqTools', 'dos/var'
DEF buf[80]:STRING, myargs[4]:ARRAY OF LONG, rdargs, ret
PROC main()
'$VER: GetString 1.00 (19.01.93)' /* version string, as C= says... */
ret := 0
myargs[2] := 'GetStringResult'
IF rdargs := ReadArgs('TITLE/A,STRING/K,VAR=VARIABLE/K,GLOBAL/S',myargs,NIL)
IF reqtoolsbase := OpenLibrary('reqtools.library', 37)
StrCopy(buf, myargs[1], StrLen(myargs[1]))
IF RtGetStringA(buf,80,myargs[0],0,0) = 0
ret := 5 /* user has cancelled! */
ELSE
SetVar(myargs[2], buf, StrLen(buf),
IF myargs[3] THEN GVF_GLOBAL_ONLY ELSE GVF_LOCAL_ONLY)
ENDIF
CloseLibrary(reqtoolsbase)
ELSE
WriteF('Could not open reqtools.library!\n')
ret := 20
ENDIF
ELSE
ret := 20
ENDIF
CleanUp( ret ) /* close and return a value */
ENDPROC