2f54c7de00
git-svn-id: svn://kolibrios.org@8097 a494cfbc-eb01-0410-851d-a64ba20cac60
53 lines
788 B
Plaintext
53 lines
788 B
Plaintext
MODULE HW;
|
|
|
|
IMPORT SYSTEM, Libdl, Args;
|
|
|
|
|
|
VAR
|
|
|
|
libc: INTEGER;
|
|
puts: PROCEDURE [linux] (pStr: INTEGER);
|
|
|
|
|
|
PROCEDURE OutStringLn (s: ARRAY OF CHAR);
|
|
BEGIN
|
|
puts(SYSTEM.ADR(s[0]))
|
|
END OutStringLn;
|
|
|
|
|
|
PROCEDURE main;
|
|
VAR
|
|
i: INTEGER;
|
|
s: ARRAY 80 OF CHAR;
|
|
|
|
BEGIN
|
|
OutStringLn("Hello");
|
|
|
|
OutStringLn("");
|
|
i := 0;
|
|
WHILE i < Args.argc DO
|
|
Args.GetArg(i, s);
|
|
INC(i);
|
|
OutStringLn(s)
|
|
END;
|
|
|
|
OutStringLn("");
|
|
i := 0;
|
|
WHILE i < Args.envc DO
|
|
Args.GetEnv(i, s);
|
|
INC(i);
|
|
OutStringLn(s)
|
|
END;
|
|
OutStringLn("");
|
|
|
|
OutStringLn("Bye")
|
|
END main;
|
|
|
|
|
|
BEGIN
|
|
libc := Libdl.open("libc.so.6", Libdl.LAZY);
|
|
SYSTEM.PUT(SYSTEM.ADR(puts), Libdl.sym(libc, "puts"));
|
|
ASSERT(puts # NIL);
|
|
main
|
|
END HW.
|