mirror of
https://github.com/ShadowKatStudios/OC-Minitel.git
synced 2024-11-27 04:18:05 +11:00
added the -s flag to fget for getting file sizes
This commit is contained in:
parent
6d0ea31c27
commit
b21295f9fb
@ -1,5 +1,6 @@
|
|||||||
local net = require "net"
|
local net = require "net"
|
||||||
local event = require "event"
|
local event = require "event"
|
||||||
|
local shell = require "shell"
|
||||||
|
|
||||||
local function parseURL(url)
|
local function parseURL(url)
|
||||||
local proto,addr = url:match("(.-)://(.+)")
|
local proto,addr = url:match("(.-)://(.+)")
|
||||||
@ -11,12 +12,16 @@ local function parseURL(url)
|
|||||||
return proto, host, port, path
|
return proto, host, port, path
|
||||||
end
|
end
|
||||||
|
|
||||||
local tArgs = {...}
|
local tArgs, tFlags = shell.parse(...)
|
||||||
local proto, host, port, path = parseURL(tArgs[1])
|
local proto, host, port, path = parseURL(tArgs[1])
|
||||||
port = tonumber(port) or 70
|
port = tonumber(port) or 70
|
||||||
|
|
||||||
local socket = net.open(host,port)
|
local socket = net.open(host,port)
|
||||||
socket:write("t"..path.."\n")
|
if tFlags.s then
|
||||||
|
socket:write("s"..path.."\n")
|
||||||
|
else
|
||||||
|
socket:write("t"..path.."\n")
|
||||||
|
end
|
||||||
local c = socket:read(1)
|
local c = socket:read(1)
|
||||||
repeat
|
repeat
|
||||||
c = socket:read(1)
|
c = socket:read(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user