xref: /aosp_15_r20/external/curl/docs/libcurl/opts/CURLOPT_PREQUOTE.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
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_PREQUOTE
5*6236dae4SAndroid Build Coastguard WorkerSection: 3
6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl
7*6236dae4SAndroid Build Coastguard WorkerSee-also:
8*6236dae4SAndroid Build Coastguard Worker  - CURLOPT_POSTQUOTE (3)
9*6236dae4SAndroid Build Coastguard Worker  - CURLOPT_QUOTE (3)
10*6236dae4SAndroid Build Coastguard WorkerProtocol:
11*6236dae4SAndroid Build Coastguard Worker  - FTP
12*6236dae4SAndroid Build Coastguard WorkerAdded-in: 7.9.5
13*6236dae4SAndroid Build Coastguard Worker---
14*6236dae4SAndroid Build Coastguard Worker
15*6236dae4SAndroid Build Coastguard Worker# NAME
16*6236dae4SAndroid Build Coastguard Worker
17*6236dae4SAndroid Build Coastguard WorkerCURLOPT_PREQUOTE - commands to run before an FTP transfer
18*6236dae4SAndroid Build Coastguard Worker
19*6236dae4SAndroid Build Coastguard Worker# SYNOPSIS
20*6236dae4SAndroid Build Coastguard Worker
21*6236dae4SAndroid Build Coastguard Worker~~~c
22*6236dae4SAndroid Build Coastguard Worker#include <curl/curl.h>
23*6236dae4SAndroid Build Coastguard Worker
24*6236dae4SAndroid Build Coastguard WorkerCURLcode curl_easy_setopt(CURL *handle, CURLOPT_PREQUOTE,
25*6236dae4SAndroid Build Coastguard Worker                          struct curl_slist *cmds);
26*6236dae4SAndroid Build Coastguard Worker~~~
27*6236dae4SAndroid Build Coastguard Worker
28*6236dae4SAndroid Build Coastguard Worker# DESCRIPTION
29*6236dae4SAndroid Build Coastguard Worker
30*6236dae4SAndroid Build Coastguard WorkerPass a pointer to a linked list of FTP commands to pass to the server after
31*6236dae4SAndroid Build Coastguard Workerthe transfer type is set. The linked list should be a fully valid list of
32*6236dae4SAndroid Build Coastguard Workerstruct curl_slist structs properly filled in as described for
33*6236dae4SAndroid Build Coastguard WorkerCURLOPT_QUOTE(3).
34*6236dae4SAndroid Build Coastguard Worker
35*6236dae4SAndroid Build Coastguard WorkerUsing this option multiple times makes the last set string override the
36*6236dae4SAndroid Build Coastguard Workerprevious ones. Set it to NULL to disable its use again.
37*6236dae4SAndroid Build Coastguard Worker
38*6236dae4SAndroid Build Coastguard Workerlibcurl does not copy the list, it needs to be kept around until after the
39*6236dae4SAndroid Build Coastguard Workertransfer has completed.
40*6236dae4SAndroid Build Coastguard Worker
41*6236dae4SAndroid Build Coastguard WorkerThese commands are not performed when a directory listing is performed, only
42*6236dae4SAndroid Build Coastguard Workerfor file transfers.
43*6236dae4SAndroid Build Coastguard Worker
44*6236dae4SAndroid Build Coastguard WorkerWhile CURLOPT_QUOTE(3) and CURLOPT_POSTQUOTE(3) work for SFTP,
45*6236dae4SAndroid Build Coastguard Workerthis option does not.
46*6236dae4SAndroid Build Coastguard Worker
47*6236dae4SAndroid Build Coastguard Worker# DEFAULT
48*6236dae4SAndroid Build Coastguard Worker
49*6236dae4SAndroid Build Coastguard WorkerNULL
50*6236dae4SAndroid Build Coastguard Worker
51*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS%
52*6236dae4SAndroid Build Coastguard Worker
53*6236dae4SAndroid Build Coastguard Worker# EXAMPLE
54*6236dae4SAndroid Build Coastguard Worker
55*6236dae4SAndroid Build Coastguard Worker~~~c
56*6236dae4SAndroid Build Coastguard Workerint main(void)
57*6236dae4SAndroid Build Coastguard Worker{
58*6236dae4SAndroid Build Coastguard Worker  struct curl_slist *cmdlist = NULL;
59*6236dae4SAndroid Build Coastguard Worker  cmdlist = curl_slist_append(cmdlist, "SYST");
60*6236dae4SAndroid Build Coastguard Worker
61*6236dae4SAndroid Build Coastguard Worker  CURL *curl = curl_easy_init();
62*6236dae4SAndroid Build Coastguard Worker  if(curl) {
63*6236dae4SAndroid Build Coastguard Worker    CURLcode res;
64*6236dae4SAndroid Build Coastguard Worker    curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
65*6236dae4SAndroid Build Coastguard Worker
66*6236dae4SAndroid Build Coastguard Worker    /* pass in the FTP commands to run */
67*6236dae4SAndroid Build Coastguard Worker    curl_easy_setopt(curl, CURLOPT_PREQUOTE, cmdlist);
68*6236dae4SAndroid Build Coastguard Worker
69*6236dae4SAndroid Build Coastguard Worker    res = curl_easy_perform(curl);
70*6236dae4SAndroid Build Coastguard Worker
71*6236dae4SAndroid Build Coastguard Worker    curl_easy_cleanup(curl);
72*6236dae4SAndroid Build Coastguard Worker  }
73*6236dae4SAndroid Build Coastguard Worker  curl_slist_free_all(cmdlist);
74*6236dae4SAndroid Build Coastguard Worker}
75*6236dae4SAndroid Build Coastguard Worker~~~
76*6236dae4SAndroid Build Coastguard Worker
77*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY%
78*6236dae4SAndroid Build Coastguard Worker
79*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE
80*6236dae4SAndroid Build Coastguard Worker
81*6236dae4SAndroid Build Coastguard WorkerReturns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
82