Fix download and upload lua scripts.
This commit is contained in:
parent
7c7f9f57f9
commit
68f047c397
@ -4,16 +4,21 @@ local shell = require("shell")
|
||||
local fs = require("filesystem")
|
||||
local os = require("os")
|
||||
|
||||
io.write("download Utility (C) Captain ALM 2020 :: BSD 2-Clause\n")
|
||||
|
||||
if not c.isAvailable("internet") then
|
||||
io.stderr:write("Internet Card Required!\n")
|
||||
return 2
|
||||
end
|
||||
|
||||
local i = c.internet
|
||||
|
||||
if(i == nil or ic == nil) then
|
||||
io.stderr:write("Internet Component/API Required!\n")
|
||||
return 2
|
||||
end
|
||||
if(not i.isTcpEnabled()) then
|
||||
io.stderr:write("TCP Support Required!\n")
|
||||
return 2
|
||||
end
|
||||
local args, options = shell.parse(...)
|
||||
@ -32,7 +37,7 @@ elseif #args == 2 then
|
||||
port = 100
|
||||
elseif #args == 3 then
|
||||
ipaddress = args[2]
|
||||
port = args[3] + 0
|
||||
port = math.floor(math.abs(args[3]))
|
||||
end
|
||||
|
||||
filename = shell.resolve(args[1])
|
||||
|
13
upload.lua
13
upload.lua
@ -4,17 +4,22 @@ local shell = require("shell")
|
||||
local fs = require("filesystem")
|
||||
local os = require("os")
|
||||
|
||||
io.write("upload Utility (C) Captain ALM 2020 :: BSD 2-Clause\n")
|
||||
|
||||
if not c.isAvailable("internet") then
|
||||
return
|
||||
io.stderr:write("Internet Card Required!\n")
|
||||
return 2
|
||||
end
|
||||
|
||||
local i = c.internet
|
||||
|
||||
if(i == nil or ic == nil) then
|
||||
return
|
||||
io.stderr:write("Internet Component/API Required!\n")
|
||||
return 2
|
||||
end
|
||||
if(not i.isTcpEnabled()) then
|
||||
return
|
||||
io.stderr:write("TCP Support Required!\n")
|
||||
return 2
|
||||
end
|
||||
local args, options = shell.parse(...)
|
||||
local filename = ""
|
||||
@ -32,7 +37,7 @@ elseif #args == 2 then
|
||||
port = 100
|
||||
elseif #args == 3 then
|
||||
ipaddress = args[2]
|
||||
port = args[3] + 0
|
||||
port = math.floor(math.abs(args[3]))
|
||||
end
|
||||
|
||||
filename = shell.resolve(args[1])
|
||||
|
Loading…
Reference in New Issue
Block a user