home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
boot
/
i386
/
root
/
usr
/
share
/
YaST2
/
modules
/
FTP.ycp
< prev
next >
Wrap
Text File
|
2006-11-29
|
1KB
|
49 lines
/**
* File: modules/FTP.ycp
* Package: Transfer Protocols
* Summary: Handle FTP Requests
* Authors: Anas Nashif <nashif@suse.de>
* Flags: Stable
*
* $Id: FTP.ycp 31241 2006-06-01 12:32:41Z locilka $
*/
{
module "FTP";
global string user = "";
global string password = "";
/**
* Send a get request
* @param url url in any standard form
* @param output file to save result to
* @return map Reponse map with HTTP code and transfer size and time
*/
global define map Get(string url, string output) ``{
y2debug("URL: %1", url);
map response = (map) SCR::Execute(.curl.get, url, $["output":output]);
return response;
}
/**
* List FTP directory
*/
global define list Dir(string url) ``{
map dir = (map) SCR::Execute(.curl.ftp.dir, url, $[]);
y2debug("returned string: %1", dir);
if(size(dir) <= 0) {
y2error("Error while trying to list directory");
return [];
}
return filter(string s, toset(splitstring(dir["output"]:"", "\r\n")), ``(s!="." && s!=".." && s!=""));
}
/* EOF */
}