CURLOPT_PREQUOTE.md (1715B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_PREQUOTE 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_POSTQUOTE (3) 9 - CURLOPT_QUOTE (3) 10 Protocol: 11 - FTP 12 Added-in: 7.9.5 13 --- 14 15 # NAME 16 17 CURLOPT_PREQUOTE - commands to run before an FTP transfer 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PREQUOTE, 25 struct curl_slist *cmds); 26 ~~~ 27 28 # DESCRIPTION 29 30 Pass a pointer to a linked list of FTP commands to pass to the server after 31 the transfer type is set. The linked list should be a fully valid list of 32 struct curl_slist structs properly filled in as described for 33 CURLOPT_QUOTE(3). 34 35 Using this option multiple times makes the last set string override the 36 previous ones. Set it to NULL to disable its use again. 37 38 libcurl does not copy the list, it needs to be kept around until after the 39 transfer has completed. 40 41 While CURLOPT_QUOTE(3) and CURLOPT_POSTQUOTE(3) work for SFTP, 42 this option does not. 43 44 # DEFAULT 45 46 NULL 47 48 # %PROTOCOLS% 49 50 # EXAMPLE 51 52 ~~~c 53 int main(void) 54 { 55 struct curl_slist *cmdlist = NULL; 56 cmdlist = curl_slist_append(cmdlist, "SYST"); 57 58 CURL *curl = curl_easy_init(); 59 if(curl) { 60 CURLcode res; 61 curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin"); 62 63 /* pass in the FTP commands to run */ 64 curl_easy_setopt(curl, CURLOPT_PREQUOTE, cmdlist); 65 66 res = curl_easy_perform(curl); 67 68 curl_easy_cleanup(curl); 69 } 70 curl_slist_free_all(cmdlist); 71 } 72 ~~~ 73 74 # %AVAILABILITY% 75 76 # RETURN VALUE 77 78 curl_easy_setopt(3) returns a CURLcode indicating success or error. 79 80 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 81 libcurl-errors(3).