Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,7 @@
---
category:
- Environment variables
- Initialization
- Simple
from: http://rosettacode.org/wiki/Environment_variables
note: Programming environment operations

View file

@ -0,0 +1,9 @@
;Task:
Show how to get one of your process's [[wp:Environment variable|environment variables]].
The available variables vary by system;   some of the common ones available on Unix include:
:::*   PATH
:::*   HOME
:::*   USER
<br><br>

View file

@ -0,0 +1 @@
print(os:getenv(HOME))

View file

@ -0,0 +1 @@
print((getenv("HOME"), new line))

View file

@ -0,0 +1,2 @@
⎕ENV 'HOME'
HOME /home/russtopia

View file

@ -0,0 +1 @@
$ awk 'BEGIN{print "HOME:"ENVIRON["HOME"],"USER:"ENVIRON["USER"]}'

View file

@ -0,0 +1 @@
$ awk -v h=$HOME -v u=$USER 'BEGIN{print "HOME:"h,"USER:"u}'

View file

@ -0,0 +1,5 @@
# http://ideone.com/St5SHF
BEGIN { print "# Environment:"
for (e in ENVIRON) { printf( "%10s = %s\n", e, ENVIRON[e] ) }
}
END { print "# Done." }

View file

@ -0,0 +1,7 @@
with Ada.Environment_Variables; use Ada.Environment_Variables;
with Ada.Text_Io; use Ada.Text_Io;
procedure Print_Path is
begin
Put_Line("Path : " & Value("PATH"));
end Print_Path;

View file

@ -0,0 +1,11 @@
with Ada.Environment_Variables; use Ada.Environment_Variables;
with Ada.Text_Io; use Ada.Text_Io;
procedure Env_Vars is
procedure Print_Vars(Name, Value : in String) is
begin
Put_Line(Name & " : " & Value);
end Print_Vars;
begin
Iterate(Print_Vars'access);
end Env_Vars;

View file

@ -0,0 +1,15 @@
with Ada.Wide_Wide_Text_IO;
with League.Application;
with League.Strings;
procedure Main is
function "+"
(Item : Wide_Wide_String) return League.Strings.Universal_String
renames League.Strings.To_Universal_String;
begin
Ada.Wide_Wide_Text_IO.Put_Line
(League.Application.Environment.Value (+"HOME").To_Wide_Wide_String);
end Main;

View file

@ -0,0 +1 @@
tell application "Finder" to get name of home

View file

@ -0,0 +1 @@
"HOME : " & (do shell script "echo $HOME" & ", PATH : " & (do shell script "echo $PATH" & ", USER : " & (do shell script "echo $USER")))

View file

@ -0,0 +1,3 @@
print ["path:" env\PATH]
print ["user:" env\USER]
print ["home:" env\HOME]

View file

@ -0,0 +1,2 @@
EnvGet, OutputVar, Path
MsgBox, %OutputVar%

View file

@ -0,0 +1,11 @@
ConsoleWrite("# Environment:" & @CRLF)
Local $sEnvVar = EnvGet("LANG")
ConsoleWrite("LANG : " & $sEnvVar & @CRLF)
ShowEnv("SystemDrive")
ShowEnv("USERNAME")
Func ShowEnv($N)
ConsoleWrite( StringFormat("%-12s : %s\n", $N, EnvGet($N)) )
EndFunc ;==>ShowEnv

View file

@ -0,0 +1,2 @@
x$ = ENVIRON$("path")
PRINT x$

View file

@ -0,0 +1,10 @@
PRINT FNenvironment("PATH")
PRINT FNenvironment("USERNAME")
END
DEF FNenvironment(envar$)
LOCAL buffer%, size%
SYS "GetEnvironmentVariable", envar$, 0, 0 TO size%
DIM buffer% LOCAL size%
SYS "GetEnvironmentVariable", envar$, buffer%, size%+1
= $$buffer%

View file

@ -0,0 +1 @@
PRINT GETENVIRON$("PATH")

View file

@ -0,0 +1 @@
echo %Foo%

View file

@ -0,0 +1,2 @@
set
set Foo

View file

@ -0,0 +1,8 @@
#include <cstdlib>
#include <cstdio>
int main()
{
puts(getenv("HOME"));
return 0;
}

View file

@ -0,0 +1,10 @@
using System;
namespace RosettaCode {
class Program {
static void Main() {
string temp = Environment.GetEnvironmentVariable("TEMP");
Console.WriteLine("TEMP is " + temp);
}
}
}

View file

@ -0,0 +1,9 @@
#include <stdlib.h>
#include <stdio.h>
int main() {
puts(getenv("HOME"));
puts(getenv("PATH"));
puts(getenv("USER"));
return 0;
}

View file

@ -0,0 +1,18 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. Environment-Vars.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 home PIC X(75).
PROCEDURE DIVISION.
* *> Method 1.
ACCEPT home FROM ENVIRONMENT "HOME"
DISPLAY home
* *> Method 2.
DISPLAY "HOME" UPON ENVIRONMENT-NAME
ACCEPT home FROM ENVIRONMENT-VALUE
GOBACK
.

View file

@ -0,0 +1 @@
(System/getenv "HOME")

View file

@ -0,0 +1,2 @@
for var_name in ['PATH', 'HOME', 'LANG', 'USER']
console.log var_name, process.env[var_name]

View file

@ -0,0 +1 @@
(lispworks:environment-variable "USER")

View file

@ -0,0 +1 @@
(sb-ext:posix-getenv "USER")

View file

@ -0,0 +1 @@
(ccl:getenv "USER")

View file

@ -0,0 +1 @@
(getenv "HOME")

View file

@ -0,0 +1,5 @@
import std.stdio, std.process;
void main() {
auto home = getenv("HOME");
}

View file

@ -0,0 +1,5 @@
import tango.sys.Environment;
void main() {
auto home = Environment("HOME");
}

View file

@ -0,0 +1,9 @@
program EnvironmentVariable;
{$APPTYPE CONSOLE}
uses SysUtils;
begin
WriteLn('Temp = ' + GetEnvironmentVariable('TEMP'));
end.

View file

@ -0,0 +1 @@
<unsafe:java.lang.System>.getenv("HOME")

View file

@ -0,0 +1,13 @@
class
APPLICATION
inherit
EXECUTION_ENVIRONMENT
create
make
feature {NONE} -- Initialization
make
-- Retrieve and print value for environment variable `USERNAME'.
do
print (get ("USERNAME"))
end
end

View file

@ -0,0 +1 @@
System.get_env("PATH")

View file

@ -0,0 +1 @@
(getenv "HOME")

View file

@ -0,0 +1 @@
os:getenv( "HOME" ).

View file

@ -0,0 +1 @@
puts(1,getenv("PATH"))

View file

@ -0,0 +1,6 @@
open System
[<EntryPoint>]
let main args =
printfn "%A" (Environment.GetEnvironmentVariable("PATH"))
0

View file

@ -0,0 +1 @@
"HOME" os-env print

View file

@ -0,0 +1 @@
s" HOME" getenv type

View file

@ -0,0 +1,15 @@
program show_home
implicit none
character(len=32) :: home_val ! The string value of the variable HOME
integer :: home_len ! The actual length of the value
integer :: stat ! The status of the value:
! 0 = ok
! 1 = variable does not exist
! -1 = variable is not long enought to hold the result
call get_environment_variable('HOME', home_val, home_len, stat)
if (stat == 0) then
write(*,'(a)') 'HOME = '//trim(home_val)
else
write(*,'(a)') 'No HOME to go to!'
end if
end program show_home

View file

@ -0,0 +1,5 @@
' FB 1.05.0 Win64
Var v = Environ("SystemRoot")
Print v
Sleep

View file

@ -0,0 +1 @@
callJava["java.lang.System", "getenv", ["HOME"]]

View file

@ -0,0 +1,3 @@
println( System.getenv('PATH') )
println( $home )
println( $user )

View file

@ -0,0 +1,8 @@
include "NSLog.incl"
NSLog(@"%@",fn NSUserName)
NSLog(@"%@",fn NSFullUserName)
NSLog(@"%@",fn NSHomeDirectory)
NSLog(@"%@",fn NSTemporaryDirectory)
HandleEvents

View file

@ -0,0 +1,10 @@
package main
import (
"fmt"
"os"
)
func main() {
fmt.Println(os.Getenv("SHELL"))
}

View file

@ -0,0 +1,19 @@
package main
import (
"fmt"
"os"
"strings"
)
func main() {
s := "SHELL"
se := s + "="
for _, v := range os.Environ() {
if strings.HasPrefix(v, se) {
fmt.Println(s, "has value", v[len(se):])
return
}
}
fmt.Println(s, "not found")
}

View file

@ -0,0 +1,2 @@
get env \foo HOME
show "\foo"

View file

@ -0,0 +1 @@
get env \foo "X Y Z"

View file

@ -0,0 +1 @@
System.getenv().each { property, value -> println "$property = $value"}

View file

@ -0,0 +1,3 @@
import System.Environment
main = do getEnv "HOME" >>= print -- get env var
getEnvironment >>= print -- get the entire environment as a list of (key, value) pairs

View file

@ -0,0 +1,3 @@
println env "HOME"
println env "PATH"
println env "USER"

View file

@ -0,0 +1,4 @@
CHARACTER string*255
string = "PATH="
SYSTEM(GEteNV = string)

View file

@ -0,0 +1,5 @@
software {
print(load("$HOME"))
print(load("$USER"))
print(load("$PATH"))
}

View file

@ -0,0 +1,28 @@
100 ASK BORDER VAR01
110 ASK DEFAULT CHANNEL VAR02
120 ASK EDITOR BUFFER VAR03
130 ASK EDITOR KEY VAR04
140 ASK EDITOR VIDEO VAR05
150 ASK FAST SAVE VAR06
160 ASK INTERRUPT KEY VAR07
170 ASK INTERRUPT NET VAR08
180 ASK INTERRUPT STOP VAR09
190 ASK KEY CLICK VAR10
200 ASK KEY DELAY VAR11
210 ASK KEY RATE VAR12
220 ASK NET CHANNEL VAR13
230 ASK NET MACHINE VAR14
240 ASK REM1 VAR15
250 ASK REM2 VAR16
260 ASK SERIAL BAUD VAR17
270 ASK SERIAL FORMAT VAR18
280 ASK STATUS VAR19
290 ASK SOUND BUFFER VAR20
300 ASK SPEAKER VAR21
310 ASK TAPE LEVEL VAR22
320 ASK TAPE SOUND VAR23
330 ASK TIMER VAR24
340 ASK VIDEO COLOR VAR25
350 ASK VIDEO MODE VAR26
360 ASK VIDEO X VAR27
370 ASK VIDEO Y VAR28

View file

@ -0,0 +1 @@
ASK machine-option-code var

View file

@ -0,0 +1,7 @@
procedure main(arglist)
if *envars = 0 then envars := ["HOME", "TRACE", "BLKSIZE","STRSIZE","COEXPSIZE","MSTKSIZE", "IPATH","LPATH","NOERRBUF"]
every v := !sort(envars) do
write(v," = ",image(getenv(v))|"* not set *")
end

View file

@ -0,0 +1 @@
2!:5'HOME'

View file

@ -0,0 +1,2 @@
System.getenv("HOME") // get env var
System.getenv() // get the entire environment as a Map of keys to values

View file

@ -0,0 +1,3 @@
var shell = new ActiveXObject("WScript.Shell");
var env = shell.Environment("PROCESS");
WScript.echo('SYSTEMROOT=' + env.item('SYSTEMROOT'));

View file

@ -0,0 +1 @@
"HOME" getenv.

View file

@ -0,0 +1 @@
env.HOME

View file

@ -0,0 +1,4 @@
/* Environment variables, in Jsi */
puts(Util.getenv("HOME"));
var environment = Util.getenv();
puts(environment.PATH);

View file

@ -0,0 +1,3 @@
@show ENV["PATH"]
@show ENV["HOME"]
@show ENV["USER"]

View file

@ -0,0 +1 @@
_getenv "HOME"

View file

@ -0,0 +1,7 @@
// version 1.0.6
// tested on Windows 10
fun main(args: Array<String>) {
println(System.getenv("SystemRoot"))
}

View file

@ -0,0 +1,5 @@
static LILCALLBACK lil_value_t fnc_env(lil_t lil, size_t argc, lil_value_t* argv)
{
if (!argc) return NULL;
return lil_alloc_string(getenv(lil_to_string(argv[0])));
}

View file

@ -0,0 +1 @@
lil_register(lil, "env", fnc_env);

View file

@ -0,0 +1,8 @@
default {
state_entry() {
llOwnerSay("llGetTimestamp()="+(string)llGetTimestamp());
llOwnerSay("llGetEnergy()="+(string)llGetEnergy());
llOwnerSay("llGetFreeMemory()="+(string)llGetFreeMemory());
llOwnerSay("llGetMemoryLimit()="+(string)llGetMemoryLimit());
}
}

View file

@ -0,0 +1,3 @@
writeln "HOME: ", _env["HOME"]
writeln "PATH: ", _env["PATH"]
writeln "USER: ", _env["USER"]

View file

@ -0,0 +1,3 @@
writeln "HOME: ", _env'HOME
writeln "PATH: ", _env'PATH
writeln "USER: ", _env'USER

View file

@ -0,0 +1,15 @@
#!/usr/bin/lasso9
define getenv(sysvar::string) => {
local(regexp = regexp(
-find = `(?m)^` + #sysvar + `=(.*?)$`,
-input = sys_environ -> join('\n'),
-ignorecase
))
return #regexp ->find ? #regexp -> matchString(1)
}
stdoutnl(getenv('HOME'))
stdoutnl(getenv('PATH'))
stdoutnl(getenv('USER'))
stdoutnl(getenv('WHAT'))

View file

@ -0,0 +1,2 @@
print StartupDir$
print DefaultDir$

View file

@ -0,0 +1,29 @@
print GetEnvironmentVariable$("USERNAME")
print GetEnvironmentVariable$("USERPROFILE") ' equivalent to UNIX HOME variable
print GetEnvironmentVariable$("PATH")
end
function GetEnvironmentVariable$(lpName$)
'get the value of an environment variable
nSize = 1024
[Retry]
lpBuffer$ = space$(nSize)
calldll #kernel32, "GetEnvironmentVariableA", _
lpName$ as ptr, _
lpBuffer$ as ptr, _
nSize as ulong, _
result as ulong
select case
' buffer too small
case result > nSize
nSize = result
goto [Retry]
' variable found
case result > 0
GetEnvironmentVariable$ = left$(lpBuffer$, result)
end select
end function

View file

@ -0,0 +1,6 @@
sx = xtra("Shell").new()
if the platform contains "win" then
path = sx.shell_cmd("echo %PATH%").line[1]
else
path = sx.shell_cmd("echo $PATH").line[1]
end if

View file

@ -0,0 +1 @@
os::environment_variable('PATH', Path).

View file

@ -0,0 +1 @@
print( os.getenv( "PATH" ) )

View file

@ -0,0 +1,26 @@
Module CheckIt {
\\ using read only variablles
Print "Platform: ";Platform$
Print "Computer Os: "; Os$
Print "Type of OS: ";OsBit;" bit"
Print "Computer Name:"; Computer$
Print "User Name: "; User.Name$
\\ using WScript.Shell
Declare objShell "WScript.Shell"
With objShell, "Environment" set env ("Process")
With env, "item" as Env$()
Print Env$("PATH")
Print Env$("HOMEPATH")
Declare objShell Nothing
\\ using internal Information object
Declare OsInfo INFORMATION
With OsInfo, "build" as build, "NtDllVersion" as NtDllVersion$
Method OsInfo, "GetCurrentProcessSID" as PID$
Method OsInfo, "IsProcessElevated" as isElevated
Print "Os build number: ";build
Print "Nr Dll version: ";NtDllVersion$
Print "ProcessSID: ";pid$
Print "Is Process Eleveted: ";isElevated
Declare OsInfo Nothing
}
Checkit

View file

@ -0,0 +1,3 @@
getenv('HOME')
getenv('PATH')
getenv('USER')

View file

@ -0,0 +1,2 @@
Set X=$ZF(-1,"show logical")
Set X=$ZF(-1,"show symbol")

View file

@ -0,0 +1,3 @@
TARGET = $(HOME)/some/thing.txt
foo:
echo $(TARGET)

View file

@ -0,0 +1,2 @@
bar:
echo "$$HOME"

View file

@ -0,0 +1,5 @@
H = oops ...
bar:
echo $HOME
# prints oops ... OME

View file

@ -0,0 +1 @@
getenv("PATH");

View file

@ -0,0 +1 @@
Environment["PATH"]

View file

@ -0,0 +1,18 @@
:- module env_var.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module maybe, string.
main(!IO) :-
io.get_environment_var("HOME", MaybeValue, !IO),
(
MaybeValue = yes(Value),
io.write_string("HOME is " ++ Value ++ "\n", !IO)
;
MaybeValue = no,
io.write_string("environment variable HOME not set\n", !IO)
).

View file

@ -0,0 +1 @@
$PATH

View file

@ -0,0 +1,15 @@
MODULE EnvVars EXPORTS Main;
IMPORT IO, Env;
VAR
k, v: TEXT;
BEGIN
IO.Put(Env.Get("HOME") & "\n");
FOR i := 0 TO Env.Count - 1 DO
Env.GetNth(i, k, v);
IO.Put(k & " = " & v & "\n")
END
END EnvVars.

View file

@ -0,0 +1,3 @@
ExpandEnvStrings $0 "%PATH%" ; Retrieve PATH and place it in builtin register 0.
ExpandEnvStrings $1 "%USERPROFILE%" ; Retrieve the user's profile location and place it in builtin register 1.
ExpandEnvStrings $2 "%USERNAME%" ; Retrieve the user's account name and place it in builtin register 2.

View file

@ -0,0 +1,60 @@
/* NetRexx */
options replace format comments java crossref symbols nobinary
runSample(arg)
return
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method sysEnvironment(vn = '') public static
if vn.length > 0 then do
envName = vn
envValu = System.getenv(envName)
if envValu = null then envValu = ''
say envName '=' envValu
end
else do
envVars = System.getenv()
key = String
loop key over envVars.keySet()
envName = key
envValu = String envVars.get(key)
say envName '=' envValu
end key
end
return
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method sysProperties(vn = '') public static
if vn.length > 0 then do
propName = vn
propValu = System.getProperty(propName)
if propValu = null then propValu = ''
say propName '=' propValu
end
else do
sysProps = System.getProperties()
key = String
loop key over sysProps.keySet()
propName = key
propValu = sysProps.getProperty(key)
say propName '=' propValu
end key
end
return
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method runSample(arg) public static
parse arg ev pv .
if ev = '' then ev = 'CLASSPATH'
if pv = '' then pv = 'java.class.path'
say '-'.left(80, '-').overlay(' Environment "'ev'" ', 5)
sysEnvironment(ev)
say '-'.left(80, '-').overlay(' Properties "'pv'" ', 5)
sysProperties(pv)
say
say '-'.left(80, '-').overlay(' Environment ', 5)
sysEnvironment()
say '-'.left(80, '-').overlay(' Properties ', 5)
sysProperties()
say
return

View file

@ -0,0 +1,4 @@
> (env "SHELL")
"/bin/zsh"
> (env "TERM")
"xterm"

View file

@ -0,0 +1,2 @@
import os
echo getEnv("HOME")

View file

@ -0,0 +1 @@
Sys.getenv "HOME"

View file

@ -0,0 +1 @@
[[[NSProcessInfo processInfo] environment] objectForKey:@"HOME"]

View file

@ -0,0 +1 @@
System getEnv("PATH") println

View file

@ -0,0 +1 @@
{System.showInfo "This is where Mozart is installed: "#{OS.getEnv 'OZHOME'}}

View file

@ -0,0 +1 @@
getenv("HOME")

Some files were not shown because too many files have changed in this diff Show more