Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into master-MC1.8

This commit is contained in:
Florian Nücke 2015-02-19 22:26:51 +01:00
commit 669526c6c1
4 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,20 @@
local args = {...}
if args[1] then
local file, reason = io.open("/etc/hostname", "w")
if not file then
io.stderr:write(reason .. "\n")
else
file:write(args[1])
file:close()
os.setenv("HOSTNAME", args[1])
os.setenv("PS1", "$HOSTNAME:$PWD# ")
end
else
local file = io.open("/etc/hostname")
if file then
io.write(file:read("*l"), "\n")
file:close()
else
io.stderr:write("Hostname not set\n")
end
end

View File

@ -13,4 +13,13 @@ shell.setAlias("rs", "redstone")
shell.setAlias("view", "edit -r") shell.setAlias("view", "edit -r")
shell.setAlias("help", "man") shell.setAlias("help", "man")
shell.setAlias("?", "man") shell.setAlias("?", "man")
shell.setAlias("cp", "cp -i") shell.setAlias("cp", "cp -i")
event.listen("init", function()
local file = io.open("/etc/hostname")
if file then
os.setenv("HOSTNAME", file:read("*l"))
os.setenv("PS1", "$HOSTNAME:$PWD# ")
file:close()
end
end)

View File

@ -0,0 +1,12 @@
NAME
hostname - Display and modify hostname
SYNOPIS
hostname [NEW NAME]
EXAMPLES
hostname
Prints currently set hostname
hostname test
Sets hostname of this computer to test

View File

@ -51,6 +51,7 @@ Kilobyte # Contributor
KITT # Knight Rider KITT # Knight Rider
Kodos # Contributor Kodos # Contributor
Laire # Perry Rhodan Laire # Perry Rhodan
Loader 1340 # Borderlands 2
LordFokas # Contributor LordFokas # Contributor
Marvin # Hitchhiker's Guide to the Galaxy Marvin # Hitchhiker's Guide to the Galaxy
Michiyo # Contributor Michiyo # Contributor