Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,17 @@
OPTION PARSE FALSE
PRAGMA INCLUDE <curl/curl.h>
PRAGMA LDFLAGS -lcurl
DECLARE easyhandle TYPE CURL*
OPEN "data.txt" FOR WRITING AS download
easyhandle = curl_easy_init()
curl_easy_setopt(easyhandle, CURLOPT_URL, "ftp://localhost/pub/data.txt")
curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA, download)
curl_easy_setopt(easyhandle, CURLOPT_USERPWD, "anonymous")
success = curl_easy_perform(easyhandle)
curl_easy_cleanup(easyhandle)
CLOSE FILE download

View file

@ -0,0 +1,46 @@
FUNCTION interact$(command$, connection, use_pasv)
LOCAL pasv$, data$, response$
LOCAL port, passive
IF use_pasv THEN
SEND "PASV" & NL$ TO connection
RECEIVE data$ FROM connection
pasv$ = INBETWEEN$(data$, "(", ")")
port = VAL(TOKEN$(pasv$, 5, ","))*256 + VAL(TOKEN$(pasv$, 6, ","))
OPEN "localhost:" & STR$(port) FOR NETWORK AS passive
ENDIF
IF LEN(command$) THEN SEND command$ & NL$ TO connection
WHILE WAIT(connection, 50)
RECEIVE data$ FROM connection
IF LEN(data$) = 0 THEN BREAK
response$ = response$ & data$
WEND
IF use_pasv THEN
WHILE WAIT(passive, 50)
RECEIVE data$ FROM passive
IF LEN(data$) = 0 THEN BREAK
response$ = response$ & data$
WEND
CLOSE NETWORK passive
ENDIF
RETURN response$
ENDFUNC
OPEN "localhost:21" FOR NETWORK AS ftp
PRINT interact$("", ftp, 0)
PRINT interact$("USER anonymous", ftp, 0)
PRINT interact$("PASS ", ftp, 0)
PRINT interact$("CWD pub", ftp, 0)
PRINT interact$("LIST", ftp, 1)
PRINT interact$("TYPE I", ftp, 0)
PRINT interact$("RETR data.txt", ftp, 1)
PRINT interact$("QUIT", ftp, 0)
CLOSE NETWORK ftp