Hostname: Difference between revisions

Content added Content deleted
(→‎{{header|JavaScript}}: Adding Lasso implementation of http host)
m (→‎{{header|REXX}}: added a comment in the REXX section header, stating that the VALUE bif's output (as shown) is the same output as HOSTNAME. -- ~~~~)
Line 472: Line 472:
=={{header|REXX}}==
=={{header|REXX}}==
===REGINA and PC/REXX under most MS NT Windows===
===REGINA and PC/REXX under most MS NT Windows===
{{incorrect|REXX|"Find the name of the host on which the routine is running."}}
This REXX solution is for REGINA and PC/REXX under the Microsoft NT family of Windows (XP, Vista, 7, etc).
This REXX solution is for REGINA and PC/REXX under the Microsoft NT family of Windows (XP, Vista, 7, etc).
<br>Other names could be used for the 3rd argument.
<br>Other names could be used for the 3rd argument.
<br><br>The &nbsp; ''computername'' &nbsp; is the same as the output for the &nbsp; '''hostname.exe''' &nbsp; program.
<lang REXX>say value('COMPUTERNAME',,"ENVIRONMENT")
<lang REXX>say value('COMPUTERNAME',,"ENVIRONMENT")
say value('OS',,"ENVIRONMENT")</lang>
say value('OS',,"ENVIRONMENT")</lang>
Line 483: Line 483:
</pre>
</pre>
===R4 and ROO under most MS NT Windows===
===R4 and ROO under most MS NT Windows===
{{incorrect|REXX|"Find the name of the host on which the routine is running."}}
This REXX solution is for R4 and ROO under the Microsoft NT family of Windows (XP, Vista, 7, etc).
This REXX solution is for R4 and ROO under the Microsoft NT family of Windows (XP, Vista, 7, etc).
<br>Other names could be used for the 3rd argument.
<br>Other names could be used for the 3rd argument.
Line 490: Line 489:


===MS DOS (without Windows), userid===
===MS DOS (without Windows), userid===
{{incorrect|REXX|"Find the name of the host on which the routine is running."}}
Under Microsoft DOS (with no Windows), the closest thing to a name of a host would be the userid.
Under Microsoft DOS (with no Windows), the closest thing to a name of a host would be the userid.
<lang rexx>say userid()</lang>
<lang rexx>say userid()</lang>


===MS DOS (without Windows), version of DOS===
===MS DOS (without Windows), version of DOS===
{{incorrect|REXX|"Find the name of the host on which the routine is running."}}
But perhaps the name or version of the MS DOS system would be more appropriate than the userid.
But perhaps the name or version of the MS DOS system would be more appropriate than the userid.
<lang REXX>'VER' /*this passes the VER command to the MS DOS system. */</lang>
<lang REXX>'VER' /*this passes the VER command to the MS DOS system. */</lang>
Line 503: Line 500:
<br>specified, in which case an asterisk (*) is returned.
<br>specified, in which case an asterisk (*) is returned.
<br>I recall (perhaps wrongly) that Windows/95 and Windows/98 had a different environmental name for the name of the host.
<br>I recall (perhaps wrongly) that Windows/95 and Windows/98 had a different environmental name for the name of the host.

===UNIX Solution===
===UNIX Solution===
This solution is platform specific and uses features that are available to the Regina implementation of Rexx.
This solution is platform specific and uses features that are available to the Regina implementation of Rexx.
:Tested with Regina on Mac OS X. Should work on other UNIX/Linux distros.
:Tested with Regina on Mac OS X. Should work on other UNIX/Linux distros.

<lang REXX>/* Rexx */
<lang REXX>/* Rexx */
address command "hostname -f" with output stem hn.
address command "hostname -f" with output stem hn.