Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sys(0) help

Status
Not open for further replies.

lisaz

Programmer
Aug 23, 2000
18
0
0
US
Something happened to one of my client's workstations.  My applications calls sys(0) to grab the machine name or user name.  This has always worked, until something happened on one of the machines.  I can't remember where this comes from either.  Any ideas?
 
The network shell controls what, if anything, is returned by SYS(0).&nbsp;&nbsp;Generally, for external clients it is inadvisable to use, because the return value is pretty unpredictable - it depends on desktop OS, network OS, and version.&nbsp;&nbsp;If a machine is not connected to a network, it may be blank or &quot;1&quot;.<br><br>For WinNT/Win2000, it seems to be the current computer user's name. <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
My application written in FoxPro2.6w has run on this novell network with windows 95 for years.&nbsp;&nbsp;One users crashed his machine and the only thing we can't get back is his network name....grabbed by sys(0).&nbsp;&nbsp;Everyone else on the network is working fine.&nbsp;&nbsp;I'll check the login script, that rings a bell.<br><br>thanks...
 
Since you use Novell,&nbsp;&nbsp;In the Network Login Script add the line<br>username = %LOGIN_NAME%<br><br>then in the Fox Application use the line<br>ucNetName = upper(alltrim(getenv(&quot;USERNAME&quot;)))<br> <p>David W. Grewe<br><a href=mailto:Dave@internationalbid.net>Dave@internationalbid.net</a><br><a href= > </a><br>
 
How do I find the login script?
 
Contact our Network Administrator<br> <p>David W. Grewe<br><a href=mailto:Dave@internationalbid.net>Dave@internationalbid.net</a><br><a href= > </a><br>
 
Just like Bob said, SYS(0) returns the network machine name (the ones you can see on the Network Neighborhood) in a Windows 95/NT environment. But Novell can override SYS(0) return value using its &quot;MACHINE&quot; environment variable. Whenever you assign value to MACHINE variable that is set within the login script, it forces SYS(0) to capture that value.<br>Login scripts are sets of batch commands that Novell executes whenever a valid user logs on to the network. You have to consult your network administrator when dealing with login script info.
 
Thanks, the person who we can't get the user name with sys(0) is also not showing up in Network Neighborhood.&nbsp;&nbsp;Thanks for everyones advice.<br><br><br>Lisa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top