1*6236dae4SAndroid Build Coastguard Worker--- 2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al. 3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl 4*6236dae4SAndroid Build Coastguard WorkerTitle: CURLOPT_QUOTE 5*6236dae4SAndroid Build Coastguard WorkerSection: 3 6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl 7*6236dae4SAndroid Build Coastguard WorkerSee-also: 8*6236dae4SAndroid Build Coastguard Worker - CURLOPT_CUSTOMREQUEST (3) 9*6236dae4SAndroid Build Coastguard Worker - CURLOPT_DIRLISTONLY (3) 10*6236dae4SAndroid Build Coastguard Worker - CURLOPT_POSTQUOTE (3) 11*6236dae4SAndroid Build Coastguard Worker - CURLOPT_PREQUOTE (3) 12*6236dae4SAndroid Build Coastguard WorkerProtocol: 13*6236dae4SAndroid Build Coastguard Worker - FTP 14*6236dae4SAndroid Build Coastguard Worker - SFTP 15*6236dae4SAndroid Build Coastguard WorkerAdded-in: 7.1 16*6236dae4SAndroid Build Coastguard Worker--- 17*6236dae4SAndroid Build Coastguard Worker 18*6236dae4SAndroid Build Coastguard Worker# NAME 19*6236dae4SAndroid Build Coastguard Worker 20*6236dae4SAndroid Build Coastguard WorkerCURLOPT_QUOTE - (S)FTP commands to run before transfer 21*6236dae4SAndroid Build Coastguard Worker 22*6236dae4SAndroid Build Coastguard Worker# SYNOPSIS 23*6236dae4SAndroid Build Coastguard Worker 24*6236dae4SAndroid Build Coastguard Worker~~~c 25*6236dae4SAndroid Build Coastguard Worker#include <curl/curl.h> 26*6236dae4SAndroid Build Coastguard Worker 27*6236dae4SAndroid Build Coastguard WorkerCURLcode curl_easy_setopt(CURL *handle, CURLOPT_QUOTE, 28*6236dae4SAndroid Build Coastguard Worker struct curl_slist *cmds); 29*6236dae4SAndroid Build Coastguard Worker~~~ 30*6236dae4SAndroid Build Coastguard Worker 31*6236dae4SAndroid Build Coastguard Worker# DESCRIPTION 32*6236dae4SAndroid Build Coastguard Worker 33*6236dae4SAndroid Build Coastguard WorkerPass a pointer to a linked list of FTP or SFTP commands to pass to the server 34*6236dae4SAndroid Build Coastguard Workerprior to your request. This is done before any other commands are issued (even 35*6236dae4SAndroid Build Coastguard Workerbefore the CWD command for FTP). The linked list should be a fully valid list 36*6236dae4SAndroid Build Coastguard Workerof 'struct curl_slist' structs properly filled in with text strings. Use 37*6236dae4SAndroid Build Coastguard Workercurl_slist_append(3) to append strings (commands) to the list, and clear 38*6236dae4SAndroid Build Coastguard Workerthe entire list afterwards with curl_slist_free_all(3). 39*6236dae4SAndroid Build Coastguard Worker 40*6236dae4SAndroid Build Coastguard WorkerUsing this option multiple times makes the last set list override the previous 41*6236dae4SAndroid Build Coastguard Workerones. Set it to NULL to disable its use again. libcurl does not copy the list, 42*6236dae4SAndroid Build Coastguard Workerit needs to be kept around until after the transfer has completed. 43*6236dae4SAndroid Build Coastguard Worker 44*6236dae4SAndroid Build Coastguard WorkerWhen speaking to an FTP server, prefix the command with an asterisk (*) to 45*6236dae4SAndroid Build Coastguard Workermake libcurl continue even if the command fails as by default libcurl stops at 46*6236dae4SAndroid Build Coastguard Workerfirst failure. 47*6236dae4SAndroid Build Coastguard Worker 48*6236dae4SAndroid Build Coastguard WorkerThe set of valid FTP commands depends on the server (see RFC 959 for a list of 49*6236dae4SAndroid Build Coastguard Workermandatory commands). 50*6236dae4SAndroid Build Coastguard Worker 51*6236dae4SAndroid Build Coastguard Workerlibcurl does not inspect, parse or "understand" the commands passed to the 52*6236dae4SAndroid Build Coastguard Workerserver using this option. If you change connection state, working directory or 53*6236dae4SAndroid Build Coastguard Workersimilar using quote commands, libcurl does not know about it. 54*6236dae4SAndroid Build Coastguard Worker 55*6236dae4SAndroid Build Coastguard WorkerThe path arguments for FTP or SFTP can use single or double quotes to 56*6236dae4SAndroid Build Coastguard Workerdistinguish a space from being the parameter separator or being a part of the 57*6236dae4SAndroid Build Coastguard Workerpath. e.g. rename with sftp using a quote command like this: 58*6236dae4SAndroid Build Coastguard Worker 59*6236dae4SAndroid Build Coastguard Worker "rename 'test/_upload.txt' 'test/Hello World.txt'" 60*6236dae4SAndroid Build Coastguard Worker 61*6236dae4SAndroid Build Coastguard Worker# SFTP commands 62*6236dae4SAndroid Build Coastguard Worker 63*6236dae4SAndroid Build Coastguard Worker## atime date file 64*6236dae4SAndroid Build Coastguard Worker 65*6236dae4SAndroid Build Coastguard WorkerThe atime command sets the last access time of the file named by the file 66*6236dae4SAndroid Build Coastguard Workeroperand. The date expression can be all sorts of date strings, see the 67*6236dae4SAndroid Build Coastguard Workercurl_getdate(3) man page for date expression details. (Added in 7.73.0) 68*6236dae4SAndroid Build Coastguard Worker 69*6236dae4SAndroid Build Coastguard Worker## chgrp group file 70*6236dae4SAndroid Build Coastguard Worker 71*6236dae4SAndroid Build Coastguard WorkerThe chgrp command sets the group ID of the file named by the file operand to 72*6236dae4SAndroid Build Coastguard Workerthe group ID specified by the group operand. The group operand is a decimal 73*6236dae4SAndroid Build Coastguard Workerinteger group ID. 74*6236dae4SAndroid Build Coastguard Worker 75*6236dae4SAndroid Build Coastguard Worker## chmod mode file 76*6236dae4SAndroid Build Coastguard Worker 77*6236dae4SAndroid Build Coastguard WorkerThe chmod command modifies the file mode bits of the specified file. The 78*6236dae4SAndroid Build Coastguard Workermode operand is an octal integer mode number. 79*6236dae4SAndroid Build Coastguard Worker 80*6236dae4SAndroid Build Coastguard Worker## chown user file 81*6236dae4SAndroid Build Coastguard Worker 82*6236dae4SAndroid Build Coastguard WorkerThe chown command sets the owner of the file named by the file operand to the 83*6236dae4SAndroid Build Coastguard Workeruser ID specified by the user operand. The user operand is a decimal 84*6236dae4SAndroid Build Coastguard Workerinteger user ID. 85*6236dae4SAndroid Build Coastguard Worker 86*6236dae4SAndroid Build Coastguard Worker## ln source_file target_file 87*6236dae4SAndroid Build Coastguard Worker 88*6236dae4SAndroid Build Coastguard WorkerThe **ln** and **symlink** commands create a symbolic link at the 89*6236dae4SAndroid Build Coastguard Workertarget_file location pointing to the source_file location. 90*6236dae4SAndroid Build Coastguard Worker 91*6236dae4SAndroid Build Coastguard Worker## mkdir directory_name 92*6236dae4SAndroid Build Coastguard Worker 93*6236dae4SAndroid Build Coastguard WorkerThe mkdir command creates the directory named by the directory_name operand. 94*6236dae4SAndroid Build Coastguard Worker 95*6236dae4SAndroid Build Coastguard Worker## mtime date file 96*6236dae4SAndroid Build Coastguard Worker 97*6236dae4SAndroid Build Coastguard WorkerThe mtime command sets the last modification time of the file named by the 98*6236dae4SAndroid Build Coastguard Workerfile operand. The date expression can be all sorts of date strings, see the 99*6236dae4SAndroid Build Coastguard Workercurl_getdate(3) man page for date expression details. (Added in 7.73.0) 100*6236dae4SAndroid Build Coastguard Worker 101*6236dae4SAndroid Build Coastguard Worker## pwd 102*6236dae4SAndroid Build Coastguard Worker 103*6236dae4SAndroid Build Coastguard WorkerThe **pwd** command returns the absolute path of the current working 104*6236dae4SAndroid Build Coastguard Workerdirectory. 105*6236dae4SAndroid Build Coastguard Worker 106*6236dae4SAndroid Build Coastguard Worker## rename source target 107*6236dae4SAndroid Build Coastguard Worker 108*6236dae4SAndroid Build Coastguard WorkerThe rename command renames the file or directory named by the source 109*6236dae4SAndroid Build Coastguard Workeroperand to the destination path named by the target operand. 110*6236dae4SAndroid Build Coastguard Worker 111*6236dae4SAndroid Build Coastguard Worker## rm file 112*6236dae4SAndroid Build Coastguard Worker 113*6236dae4SAndroid Build Coastguard WorkerThe rm command removes the file specified by the file operand. 114*6236dae4SAndroid Build Coastguard Worker 115*6236dae4SAndroid Build Coastguard Worker## rmdir directory 116*6236dae4SAndroid Build Coastguard Worker 117*6236dae4SAndroid Build Coastguard WorkerThe rmdir command removes the directory entry specified by the directory 118*6236dae4SAndroid Build Coastguard Workeroperand, provided it is empty. 119*6236dae4SAndroid Build Coastguard Worker 120*6236dae4SAndroid Build Coastguard Worker## statvfs file 121*6236dae4SAndroid Build Coastguard Worker 122*6236dae4SAndroid Build Coastguard WorkerThe statvfs command returns statistics on the file system in which specified 123*6236dae4SAndroid Build Coastguard Workerfile resides. (Added in 7.49.0) 124*6236dae4SAndroid Build Coastguard Worker 125*6236dae4SAndroid Build Coastguard Worker## symlink source_file target_file 126*6236dae4SAndroid Build Coastguard Worker 127*6236dae4SAndroid Build Coastguard WorkerSee ln. 128*6236dae4SAndroid Build Coastguard Worker 129*6236dae4SAndroid Build Coastguard Worker# DEFAULT 130*6236dae4SAndroid Build Coastguard Worker 131*6236dae4SAndroid Build Coastguard WorkerNULL 132*6236dae4SAndroid Build Coastguard Worker 133*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS% 134*6236dae4SAndroid Build Coastguard Worker 135*6236dae4SAndroid Build Coastguard Worker# EXAMPLE 136*6236dae4SAndroid Build Coastguard Worker 137*6236dae4SAndroid Build Coastguard Worker~~~c 138*6236dae4SAndroid Build Coastguard Workerint main(void) 139*6236dae4SAndroid Build Coastguard Worker{ 140*6236dae4SAndroid Build Coastguard Worker struct curl_slist *cmdlist = NULL; 141*6236dae4SAndroid Build Coastguard Worker cmdlist = curl_slist_append(cmdlist, "RNFR source-name"); 142*6236dae4SAndroid Build Coastguard Worker cmdlist = curl_slist_append(cmdlist, "RNTO new-name"); 143*6236dae4SAndroid Build Coastguard Worker 144*6236dae4SAndroid Build Coastguard Worker CURL *curl = curl_easy_init(); 145*6236dae4SAndroid Build Coastguard Worker if(curl) { 146*6236dae4SAndroid Build Coastguard Worker CURLcode res; 147*6236dae4SAndroid Build Coastguard Worker curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin"); 148*6236dae4SAndroid Build Coastguard Worker 149*6236dae4SAndroid Build Coastguard Worker /* pass in the FTP commands to run before the transfer */ 150*6236dae4SAndroid Build Coastguard Worker curl_easy_setopt(curl, CURLOPT_QUOTE, cmdlist); 151*6236dae4SAndroid Build Coastguard Worker 152*6236dae4SAndroid Build Coastguard Worker res = curl_easy_perform(curl); 153*6236dae4SAndroid Build Coastguard Worker 154*6236dae4SAndroid Build Coastguard Worker curl_easy_cleanup(curl); 155*6236dae4SAndroid Build Coastguard Worker } 156*6236dae4SAndroid Build Coastguard Worker 157*6236dae4SAndroid Build Coastguard Worker curl_slist_free_all(cmdlist); 158*6236dae4SAndroid Build Coastguard Worker} 159*6236dae4SAndroid Build Coastguard Worker~~~ 160*6236dae4SAndroid Build Coastguard Worker 161*6236dae4SAndroid Build Coastguard Worker# HISTORY 162*6236dae4SAndroid Build Coastguard Worker 163*6236dae4SAndroid Build Coastguard WorkerSFTP support added in 7.16.3. *-prefix for SFTP added in 7.24.0 164*6236dae4SAndroid Build Coastguard Worker 165*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY% 166*6236dae4SAndroid Build Coastguard Worker 167*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE 168*6236dae4SAndroid Build Coastguard Worker 169*6236dae4SAndroid Build Coastguard WorkerReturns CURLE_OK 170