projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
df40e4d
)
libs/core: Added target parameter to luci.sys.httpget
author
Steven Barth
<steven@midlink.org>
Tue, 26 Aug 2008 18:02:27 +0000
(18:02 +0000)
committer
Steven Barth
<steven@midlink.org>
Tue, 26 Aug 2008 18:02:27 +0000
(18:02 +0000)
libs/sys/luasrc/sys.lua
patch
|
blob
|
history
diff --git
a/libs/sys/luasrc/sys.lua
b/libs/sys/luasrc/sys.lua
index
bce4e8a
..
557a7ce
100644
(file)
--- a/
libs/sys/luasrc/sys.lua
+++ b/
libs/sys/luasrc/sys.lua
@@
-106,10
+106,16
@@
end
--- Returns the contents of a documented referred by an URL.
-- @param url The URL to retrieve
-- @param stream Return a stream instead of a buffer
--- Returns the contents of a documented referred by an URL.
-- @param url The URL to retrieve
-- @param stream Return a stream instead of a buffer
+-- @param target Directly write to target file name
-- @return String containing the contents of given the URL
-- @return String containing the contents of given the URL
-function httpget(url, stream)
- local source = stream and io.open or luci.util.exec
- return source("wget -qO- '"..url:gsub("'", "").."'")
+function httpget(url, stream, target)
+ if not target then
+ local source = stream and io.open or luci.util.exec
+ return source("wget -qO- '"..url:gsub("'", "").."'")
+ else
+ return os.execute("wget -qO '%s' '%s'" %
+ {target:gsub("'", ""), url:gsub("'", "")})
+ end
end
--- Returns the system load average values.
end
--- Returns the system load average values.