[comp.sys.ibm.pc] Clipper - DOS variable help needed.

ssdesai@elbereth.rutgers.edu (Sunil S. Desai) (01/11/90)

Hi!
This is for Clipper programmers.  How do you access DOS variable from
Clipper application?

I am writing a network application that need to know the user name for
certain operations.  What I am trying to do is use DOS SET command to 
SET USER=SUNIL from NetWare login script and then read USER variable from
Clipper to do some operations.

I have Funcky and NetLib clipper libraries.  Funcky does not have any
functions to access DOS variables.  NetLib has a Whoami function that
can return the user's login name but I am trying to avoid extra overhead
of linking NetLib library for just one function. 

Any suggestions or pointers to such utility are most welcome.

Thanks in advance.

sunil
~~~~~

nfs0294@dsac.dla.mil (Glendell R. Midkiff) (01/11/90)

From article <Jan.10.14.08.52.1990.10441@elbereth.rutgers.edu$, by ssdesai@elbereth.rutgers.edu (Sunil S. Desai):
$ Hi!
$ This is for Clipper programmers.  How do you access DOS variable from
$ Clipper application?
$ 
$ I am writing a network application that need to know the user name for
$ certain operations.  What I am trying to do is use DOS SET command to 
$ SET USER=SUNIL from NetWare login script and then read USER variable from
$ Clipper to do some operations.
$ 
Have you tried the Clipper function GETE().  It seems to do what you want
to do.  See page 6-96 of Clipper manual.


-- 
 |-----------------------------------------------------------------------|
 |Glen Midkiff   osu-cis!dsacg1!gmidkiff                                 |
 |From the Internet: gmidkiff@dsac.dla.mil                               |
 |Phone: (614)-238-9643 @DLA, Systems Automation Center, Columbus, Oh.   |

cs4g6ag@maccs.dcss.mcmaster.ca (Stephen M. Dunn) (01/13/90)

In article <Jan.10.14.08.52.1990.10441@elbereth.rutgers.edu> ssdesai@elbereth.rutgers.edu (Sunil S. Desai) writes:
$This is for Clipper programmers.  How do you access DOS variable from
$Clipper application?
$I am writing a network application that need to know the user name for
$certain operations.  What I am trying to do is use DOS SET command to 
$SET USER=SUNIL from NetWare login script and then read USER variable from
$Clipper to do some operations.

   From the Clipper Summer '87 manual, "Summary of Clipper Functions", page
6-8:

GETE(<expC>)
	Returns the contents of a DOS environment variable specified by
	<expC> as a character string.

   So, you'd just do something like

USERNAME = GETE ("USER")
DO CASE
CASE USER = "SUNIL"
:
:
:
-- 
Stephen M. Dunn                               cs4g6ag@maccs.dcss.mcmaster.ca
          <std_disclaimer.h> = "\nI'm only an undergraduate!!!\n";
****************************************************************************
    If it's true that love is only a game//Well, then I can play pretend

santol@cbnewsc.ATT.COM (shawn.r.antol) (01/17/90)

In article <Jan.10.14.08.52.1990.10441@elbereth.rutgers.edu>, ssdesai@elbereth.rutgers.edu (Sunil S. Desai) writes:

> I have Funcky and NetLib clipper libraries.  Funcky does not have any
> functions to access DOS variables.  NetLib has a Whoami function that
> can return the user's login name but I am trying to avoid extra overhead
> of linking NetLib library for just one function. 

One way I have accessed the USER ID is to have the autoexec.bat file
pass the station ID to the Clipper EXEcutable file.  

This is what your main.prg file would look like before compiling:

	Parameters  user_id
	clear
	if type("user_id") = "U"
		user_id = "Un-Known"
	endif
	@ 10,10 say "Welcome " + user_id
	quit
	
The autoexec.bat would look something like this:

path c:\;c:\dos
split			; set DOS error level to the station ID
if errorlevel 1 goto serv1
if errorlevel 2 goto serv2
	:
	:
if errorlevel x goto servx
:serv1
main TERM1
goto exit
:serv2
main TERM2
goto exit
	.
	.
	.
:exit


Shawn R. Antol
AT&T Bell Labs
Naperville, IL.
708-979-5622
Reply to:	att!ihlpb!santol

UNIVREL@AUVM.BITNET (01/18/90)

It seems to me that you should be able to use CLIPPER's own GETE() function
to read DOS environment variables.  See CLIPPER's reference manual, Page 6-96.
However, I have never tried this in a network environment.

Hope this helps.
Sajjad Ahrabi